Search documentation
karat

+

K

User Documentation ↗

Getting started

To make API calls, please follow the subsequent steps.

  1. Find your hostname
  2. Get an authentication token
  3. Make a request

Find your hostname

The hostname is present in all URLs when accessing Palantir applications through the user interface. Find your hostname from your browser's URL address bar while logged into Palantir. The hostname should look like the following: https://<hostname>/.

Get an authentication token

Follow the steps in Authentication to get an authentication token.

Make a request

After getting your hostname and authentication token, you can use API clients to interact with the API.

All API calls to Foundry API should use HTTPS and the hostname for the particular instance.

Example Requests

Using cURL

Run the following to get the list of employee objects in your Ontology by calling the list objects endpoint:

Copied!
1 2 curl -H "Content-type: application/json" -H "Authorization: Bearer <your token>" \ "https://<hostname>/api/v1/ontologies/ri.ontology.main.ontology.00000000-0000-0000-0000-000000000000/objects/employee"

To send a POST request, use the -d flag to include a POST body and be sure to set a Content-type of application/json.

Run the following to call the apply action endpoint and trigger the renameEmployee action:

Copied!
1 2 3 curl -X POST -H "Content-type: application/json" -H "Authorization: Bearer <your token>" \ "https://<hostname>/api/v1/ontologies/ri.ontology.main.ontology.00000000-0000-0000-0000-000000000000/actions/renameEmployee/apply" \ -d '{"parameters": {"id": 80060, "newName": "Anna Smith-Doe"}}'

Using Python

Run the following to get the list of employee objects in your Ontology by calling the list objects endpoint:

Copied!
1 2 3 4 5 6 7 8 import requests bearer_token = "" # Save token to this variable url = "https://<hostname>/api/v1/ontologies/ri.ontology.main.ontology.efc12906-e7cd-49dc-b102-ff73e52535c8/objects/employee" headers = { "Authorization": "Bearer " + bearer_token } response = requests.get(url, headers=headers) print(response.json())

Run the following to call the apply action endpoint and trigger the renameEmployee action:

Copied!
1 2 3 4 5 6 7 8 9 10 11 12 import requests bearer_token = "" # Save token to this variable url = "https://<hostname>/api/v1/ontologies/ri.ontology.main.ontology.efc12906-e7cd-49dc-b102-ff73e52535c8/actions/renameEmployee/apply" headers = { "Authorization": "Bearer " + bearer_token, "Content-Type": "application/json" } request_body = {"parameters": {"id": 80060, "newName": "Anna Smith-Doe"}} response = requests.post(url, headers=headers, json=request_body) print(response.json())

Using NodeJS

These requests should be executed from a NodeJS client, not from a browser.

Run the following to get the list of employee objects in your Ontology by calling the list objects endpoint:

Copied!
1 2 3 4 5 6 7 8 var bearerToken = ""; // Save token to this variable var url = "https://<hostname>/api/v1/ontologies/ri.ontology.main.ontology.efc12906-e7cd-49dc-b102-ff73e52535c8/objects/employee"; fetch(url, { headers: { "Authorization": "Bearer " + bearerToken } }).then(response => response.json()) .then(data => console.log(JSON.stringify(data)));

Run the following to call the apply action endpoint and trigger the renameEmployee action:

Copied!
1 2 3 4 5 6 7 8 9 10 11 12 var bearerToken = ""; // Save token to this variable var url = "https://<hostname>/api/v1/ontologies/ri.ontology.main.ontology.efc12906-e7cd-49dc-b102-ff73e52535c8/actions/renameEmployee/apply"; var requestBody = {"parameters": {"id": 80060, "newName": "Anna Smith-Doe"}}; fetch(url, { method: 'POST', headers: { "Authorization": "Bearer " + bearerToken, 'Content-Type': 'application/json', }, body: JSON.stringify(requestBody), }).then(response => response.json()) .then(data => console.log(data));

Using Java

Run the following to get the list of employee objects in your Ontology by calling the list objects endpoint:

Copied!
1 2 3 4 5 6 7 8 9 10 String bearerToken = ""; // Save token to this variable String url = "https://<hostname>/api/v1/ontologies/ri.ontology.main.ontology.efc12906-e7cd-49dc-b102-ff73e52535c8/objects/employee"; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(url)) .header("Authorization", "Bearer " + bearerToken) .build(); HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body());

Run the following to call the apply action endpoint and trigger the renameEmployee action:

Copied!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 String bearerToken = ""; // Save token to this variable String url = "https://<hostname>/api/v1/ontologies/ri.ontology.main.ontology.efc12906-e7cd-49dc-b102-ff73e52535c8/actions/renameEmployee/apply"; String requestBody = "{\"parameters\": {\"id\": 80060, \"newName\": \"Anna Smith-Doe\"}}"; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(url)) .header("Authorization", "Bearer " + bearerToken) .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(requestBody)) .build(); HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body());