Skip to content

Instantly share code, notes, and snippets.

@alecbw
Created September 5, 2023 20:53
Show Gist options
  • Save alecbw/9b4e6f21185abb3bc36a6fa2f9c973e3 to your computer and use it in GitHub Desktop.
Save alecbw/9b4e6f21185abb3bc36a6fa2f9c973e3 to your computer and use it in GitHub Desktop.

Revisions

  1. alecbw created this gist Sep 5, 2023.
    29 changes: 29 additions & 0 deletions SourceStack_Node_AF_Call.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    const axios = require('axios');

    const data = {
    "count_only": false,
    "limit": 100,
    "export": "caller", // returns JSON
    "fields": ["job_name", "department", "hours", "seniority", "remote", "company_name", "company_url", "post_url_https", "board_url", "tags_matched", "tag_categories", "categories", "company_categories", "job_location", "city", "region", "country", "addresses", "comp_est", "comp_range", "language", "twitter_url", "linkedin_url", "github_url", "logo_url", "contact_url", "about_url", "author", "emails", "last_indexed", "job_published_at", "post_html", "company_description", "alexa_rank", "domcop_rank"],
    "filters": [
    {"field": "categories", "operator": "CONTAINS_ANY", "value": ["Graphic Design", "Logo Design"]},
    {"field": "country", "operator": "IS_IN", "value": ['United States', 'Canada']},
    {"field": "company_url", "operator": "NOT_EQUALS", "value": null}
    ]
    };

    const jsonData = JSON.stringify(data);

    const headers = {
    'Content-Type': 'application/json',
    'X-API-KEY': process.env.SOURCESTACK_KEY
    };


    axios.post('https://sourcestack-api.com/jobs', jsonData, { headers })
    .then((response) => {
    console.log('Response:', response.data);
    })
    .catch((error) => {
    console.error('Error:', error);
    });