Review Vacancies/Applications in Bulk
Use Case
Retrieve all vacancies within a system along with specific data attributes specified in a layout listing.
This workflow can also be used to view all applications with a specific layout listing.
Prerequisites
- A valid layout ID for the layout you would like to specify when retrieving all vacancies.
This example will involve using the REST API
Retrieve the Layout Headings
Layout lists allow users to select multiple fields to be displayed as columns when viewing a selection of vacancies, applications, or any other list of objects within the system. For example, a recruiter may want to see a list of all vacancies in the system, with key information such as the vacancy live date, closing date & number of applications.
See the Additional Attributes concept for more information on Layout Lists.
import requests
import json
# Authentication details for target system
username = "user"
password = "password"
# The ID of the layout specifying which data we want to retrieve for all vacancies
layout_id = 6
url = "https://your-system.tal.net/vx/api/v1/layout_listings/config/{}".format(
layout_id)
headers = {"accept": "application/json"}
# Fetch the layout configuration
response = requests.get(url, auth=(username, password), headers=headers)
layout_headings = []
if(response.ok):
# Get all headings associated with this layout and store them in the 'columns' array
jData = json.loads(response.content.decode('utf-8'))
for column in jData["columns"]:
layout_headings.append(column["heading"])
else:
# Display the http error code along with the description
response.raise_for_status()
Retrieve All Vacancies
Once we have our layout headings, we can retrieve all vacancies and match each layout value to its associated heading.
url = "https://your-system.tal.net/vx/api/v1/vacancies?layout={}".format(
layout_id)
# Fetch all vacancies
response = requests.get(url, auth=(username, password), headers=headers)
vacancies = []
if(response.ok):
# Get layout contents for all vacancies, and match them to their column heading.
jData = json.loads(response.content.decode('utf-8'))
for item in jData:
vacancy = {}
for idx, layout_data in enumerate(item["layout_data"]):
vacancy[layout_headings[idx]] = layout_data["value"]
vacancies.append(vacancy)
print(json.dumps(vacancies, indent=4,))
else:
response.raise_for_status()