Created
September 5, 2023 20:53
-
-
Save alecbw/9b4e6f21185abb3bc36a6fa2f9c973e3 to your computer and use it in GitHub Desktop.
A POST API call to the SourceStack jobs endpoint to find up to 100 jobs in the United States or Canada that are related to Graphic Design or Logo Design and have a company_url associated with them
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment