Authentification
Foreword
An API Key can be created by your onboard administrator in the settings. The administrator can define the scope of permissions of your API Key, to restrict the data you can access.
An API KEY should look like this: CXX3VVA92XsAxEFD0XQ2FY3WhEErpLbe
The API key has to be included in all API requests to the server in the http header, which should look like this:
{
"Accept": "application/json",
"Content-Type": "application/json",
"API-KEY": "CXX3VVA92XsAxEFD0XQ2FY3WhEErpLbe",
}
You can find more information in the Help Center.
Examples
You can authenticate to our API by passing your API Key in the header, here are a few possibilities.
- JavaScript
- Shell
- Python
- Java
- Ruby
// Create a new XMLHttpRequest object
const xhr = new XMLHttpRequest();
// Open a new request
xhr.open("GET", "https://your-subdomain.onboard.org/services/api/v1/employees", true);
// Set the request headers
xhr.setRequestHeader("API-KEY", "CXX3VVA92XsAxEFD0XQ2FY3WhEErpLbe");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Accept", "application/json");
// Define what happens on successful response
xhr.onload = function () {
if (xhr.status >= 200 && xhr.status < 300) {
console.log("Response received:", JSON.parse(xhr.responseText));
} else {
console.error("Request failed with status:", xhr.status, xhr.statusText);
}
};
// Send the request
xhr.send();
curl -X GET "https://your-subdomain.onboard.org/services/api/v1/employees" \
-H "API-KEY: CXX3VVA92XsAxEFD0XQ2FY3WhEErpLbe" \
-H "Content-Type: application/json" \
-H "Accept: application/json"
# Define the headers, including the API key
headers = {
"API-KEY": "CXX3VVA92XsAxEFD0XQ2FY3WhEErpLbe",
"Content-Type": "application/json",
"Accept": "application/json"
}
# Make the GET request
response = requests.get("https://your-subdomain.onboard.org/services/api/v1/employees", headers=headers)
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class ApiRequestExample {
public static void main(String[] args) throws Exception {
// Define the endpoint URL
URL url = new URL("https://your-subdomain.onboard.org/services/api/v1/employees");
// Open a connection to the URL
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
// Set the request method and headers
connection.setRequestMethod("GET");
connection.setRequestProperty("API-KEY", "CXX3VVA92XsAxEFD0XQ2FY3WhEErpLbe");
connection.setRequestProperty("Accept", "application/json");
connection.setRequestProperty("Content-Type", "application/json");
// Read and print the response
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null) {
System.out.println(inputLine);
}
in.close();
}
}
require 'net/http'
require 'uri'
# Define the endpoint URL and API key
url = URI("https://your-subdomain.onboard.org/services/api/v1/employees")
# Create the HTTP request
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["API-KEY"] = "CXX3VVA92XsAxEFD0XQ2FY3WhEErpLbe"
request["Content-Type"] = "application/json"
request["Accept"] = "application/json"
# Send the request and print the response
response = http.request(request)
puts response.body