Exploring the CareerJet Public API with JavaScript

CareerJet is a popular job search engine that offers a public API for developers to access its job listing data. In this blog post, we’ll explore the CareerJet API and write some JavaScript code to interact with it.

Getting started

Before we dive in, let’s go over the basics of the CareerJet API. In order to use it, you’ll need an API key. Head over to https://www.careerjet.com/partners/api/ to sign up for an account and obtain your key.

Once you have your key, you can start making API requests. The CareerJet API supports both JSON and XML formats. For the sake of simplicity, we’ll be using JSON in this tutorial.

Example API calls

Searching for jobs

To search for job listings, we’ll be using the jobs endpoint. Here’s an example of how we can make a GET request to the API to search for data scientist jobs in New York City:

const apiKey = 'YOUR_API_KEY';
const query = 'data scientist';
const location = 'new york';

const url = `https://public.api.careerjet.net/search?apikey=${apiKey}&keywords=${query}&location=${location}&sort=salary`;

fetch(url)
  .then(response => response.json())
  .then(data => {
    console.log(data);
  });

In this example, we’re using the fetch() function to make the API request. We pass in the API key, search query, and location as parameters in the URL. We’re also sorting the results by salary.

The response from the API will be in JSON format, which we can access by chaining a .json() call onto the response. In this example, we’re logging the entire response object to the console.

Retrieving job details

Once we have a list of job listings, we can retrieve more detailed information about a specific job using the job endpoint. Here’s an example of how we can make a GET request to the API to retrieve details about a job:

const apiKey = 'YOUR_API_KEY';
const jobId = '1234567890';

const url = `https://public.api.careerjet.net/job?apikey=${apiKey}&id=${jobId}`;

fetch(url)
  .then(response => response.json())
  .then(data => {
    console.log(data);
  });

In this example, we’re passing in the API key and the ID of the job we want to retrieve details for. We’re also using the fetch() function to make the API request and logging the response to the console.

Conclusion

In this blog post, we explored the basics of the CareerJet public API and wrote some JavaScript code to interact with it. With this knowledge, you can easily integrate CareerJet job listings into your web application and provide more value to your users.

Related APIs in Jobs