Making your first API request
Overview
You’ve recently received StackOne access and wanted to initiate your first API call using Unified API. As an introduction to StackOne Unified API, you’ve tried testing account connection through StackOne Dashboard.
Now you want to integrate a specific provider into your existing application and test the integration. In this example, you will be trying to:
– list applications for the Greenhouse account
– get particular contact for the HubSpot account
– create an employee for the BambooHR account
Prerequisites
-
API key created in StackOne Dashboard and copied to a safe place
Important:
Keep your API key protected, and do NOT share it insecurely.
-
Integration of needed provider was enabled
-
Account linked
-
(Optional) Install and use Postman
Getting account ID
- Specify the type of request, URL, and API key in the Authorization section (append to the header). cURL example:
curl --request GET
--url <https://api.stackone.com/accounts>
--header 'accept: application/json'
--header 'authorization: Basic your_api_key'
- To filter results by specific provider account (e.g., ATS Greenhouse), you have to define the
provider
param, e.g.
–provider=greenhouse
–provider=hubspot
–provider=bamboohr
- From the
/accounts
API call, you received theid
value. Copy it to a clipboard.
ATS: list applications in Greenhouse
-
Specify the list applications’ URL and header details:
–https://api.stackone.com/unified/ats/applications
–x-account-id:<id_from_Accounts_call>
Note:
Authorization remains the same
-
As a result, you’ve received a collection of existing applications with such crucial data:
– application id
– candidate id
– job id
– location id
– status
– created and updated timestamps, etc. -
(Optional) Now you can use the data from the previous step to create applications by POSTing your changes via API.
CRM: get contact in HubSpot
-
Specify the list contacts’ URL and header details:
–https://api.stackone.com/unified/crm/contacts/
–x-account-id:<id_from_Accounts_call>
-
Choose a required contact from the entire contacts collection and copy its id to a clipboard.
-
Paste id inside URL.
-
You’ve received all available data for the specified contact, including:
– first name, last name
– company name
– email(s)
– phone number(s)
– associated account id
– created and updated timestamps, etc.
HRIS: create employee in BambooHR
-
Specify the list employees’ URL and header details to see a sample employee array:
–https://api.stackone.com/unified/hris/employees
–x-account-id:<id_from_Accounts_call>
-
In a separate tab, open POST method request with the same URL, Authorization, and
x-account-id
header. -
Specify employee details in the body, for example:
{
"first_name": "John",
"last_name": "Doe",
"name": "John Doe",
"display_name": "Dr. John Doe",
"work_email": "[email protected]",
"job_title": "Consultant",
"gender": {
"value": "male"
},
"ethnicity": {
"value": "white"
},
"marital_status": {
"value": "single"
},
"employment_type": {
"value": "full_time"
},
"employment_contract_type": {
"value": "full_time"
},
"employment_status": {
"value": "active"
},
"home_location": {
"country": {
"value": "AF"
},
"state": {
"value": "AD-07"
}
},
"work_location": {
"country": {
"value": "AF"
},
"state": {
"value": "AD-07"
}
}
}
-
In a normal scenario, you've received 🟢
201 Status Code
with the messageRecord created successfully
and its timestamp. -
(Optional) To verify the record creation, modify
GET
request from step 1 to include the newly created employee id.
References
- List Accounts
- List Applications
- Create Application
- Supported Providers
- Get Contact
- Create an Employee
- StackOne Unified API collection in Postman
Updated 5 months ago