Introduction
This article is a part of a series of articles covering the workable API in depth, and covers the specific use case of using the workable API to Get all candidates for a job from Workable API.
You can find all the other use cases we have covered for the workable API along with a comprehensive deep dive on its various aspects like authentication, rate limits etc here.
Get all candidates for a job from Workable API
To retrieve all candidates for a specific job using the Workable API, you can follow these steps. This guide will help you fetch the first name, last name, and email of each candidate who has applied for a particular job.
Step 1: Set up your environment
Ensure you have the necessary libraries installed. You can install the required libraries using pip:
pip install requests
Step 2: Define the API endpoint and parameters
Use the /candidates
endpoint to get a list of candidates for a specific job. You will need to provide the job's shortcode as a query parameter.
Example Request:
import requests
subdomain = 'your_subdomain'
shortcode = 'your_job_shortcode'
access_token = 'your_access_token'
url = f'https://{subdomain}.workable.com/spi/v3/candidates'
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {access_token}'
}
params = {
'shortcode': shortcode,
'stage': 'applied'
}
response = requests.get(url, headers=headers, params=params)
candidates = response.json().get('candidates', [])
for candidate in candidates:
print(f"First Name: {candidate.get('firstname')}, Last Name: {candidate.get('lastname')}, Email: {candidate.get('email')}")
Step 3: Handle the response
The response will contain a list of candidates. Each candidate object will have keys such as firstname
, lastname
, and email
. You can iterate through the list and extract the required information.
Example Response:
{
"candidates": [
{
"id": "ce4da98",
"firstname": "Lakita",
"lastname": "Marrero",
"email": "lakita_marrero@gmail.com",
"stage": "applied"
},
{
"id": "108d1748",
"firstname": "Cindy",
"lastname": "Sawyers",
"email": "cindy_sawyers@gmail.com",
"stage": "applied"
}
]
}
By following these steps, you can efficiently retrieve and display the first name, last name, and email of each candidate who has applied for a specific job using the Workable API.
Knit for Workable API Integration
For quick and seamless access to workable API, Knit API offers a convenient solution. By integrating with Knit just once, you can streamline the entire process. Knit takes care of all the authentication, authorization, and ongoing integration maintenance, this approach not only saves time but also ensures a smooth and reliable connection to your workable API.