Batch create external knowledge
curl --request POST \
--url https://myorg.tribalhabits.com/papi/external_knowledges/batch_save \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"external_knowledges": [
{
"user_name": "johnny",
"title": "First Aid Certificate",
"provider": "Red Cross",
"type": "Certificate",
"date_obtained": "1/6/2021",
"expires": "1/6/2024"
},
{
"user_name": "mary",
"title": "Forklift Licence",
"provider": "WorkSafe",
"type": "License",
"date_obtained": "2023-03-15"
}
]
}
'import requests
url = "https://myorg.tribalhabits.com/papi/external_knowledges/batch_save"
payload = { "external_knowledges": [
{
"user_name": "johnny",
"title": "First Aid Certificate",
"provider": "Red Cross",
"type": "Certificate",
"date_obtained": "1/6/2021",
"expires": "1/6/2024"
},
{
"user_name": "mary",
"title": "Forklift Licence",
"provider": "WorkSafe",
"type": "License",
"date_obtained": "2023-03-15"
}
] }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
external_knowledges: [
{
user_name: 'johnny',
title: 'First Aid Certificate',
provider: 'Red Cross',
type: 'Certificate',
date_obtained: '1/6/2021',
expires: '1/6/2024'
},
{
user_name: 'mary',
title: 'Forklift Licence',
provider: 'WorkSafe',
type: 'License',
date_obtained: '2023-03-15'
}
]
})
};
fetch('https://myorg.tribalhabits.com/papi/external_knowledges/batch_save', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://myorg.tribalhabits.com/papi/external_knowledges/batch_save",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'external_knowledges' => [
[
'user_name' => 'johnny',
'title' => 'First Aid Certificate',
'provider' => 'Red Cross',
'type' => 'Certificate',
'date_obtained' => '1/6/2021',
'expires' => '1/6/2024'
],
[
'user_name' => 'mary',
'title' => 'Forklift Licence',
'provider' => 'WorkSafe',
'type' => 'License',
'date_obtained' => '2023-03-15'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}using RestSharp;
var options = new RestClientOptions("https://myorg.tribalhabits.com/papi/external_knowledges/batch_save");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "<api-key>");
request.AddJsonBody("{\n \"external_knowledges\": [\n {\n \"user_name\": \"johnny\",\n \"title\": \"First Aid Certificate\",\n \"provider\": \"Red Cross\",\n \"type\": \"Certificate\",\n \"date_obtained\": \"1/6/2021\",\n \"expires\": \"1/6/2024\"\n },\n {\n \"user_name\": \"mary\",\n \"title\": \"Forklift Licence\",\n \"provider\": \"WorkSafe\",\n \"type\": \"License\",\n \"date_obtained\": \"2023-03-15\"\n }\n ]\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
require 'uri'
require 'net/http'
url = URI("https://myorg.tribalhabits.com/papi/external_knowledges/batch_save")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"external_knowledges\": [\n {\n \"user_name\": \"johnny\",\n \"title\": \"First Aid Certificate\",\n \"provider\": \"Red Cross\",\n \"type\": \"Certificate\",\n \"date_obtained\": \"1/6/2021\",\n \"expires\": \"1/6/2024\"\n },\n {\n \"user_name\": \"mary\",\n \"title\": \"Forklift Licence\",\n \"provider\": \"WorkSafe\",\n \"type\": \"License\",\n \"date_obtained\": \"2023-03-15\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"created": 2,
"updated": 0,
"unchanged": 0
}{
"error": "Rate limit exceeded. Please slow down.",
"retry_after_seconds": 23
}External Knowledge
Batch create external knowledge
This endpoint creates multiple external knowledge records in one call. Each record accepts the same fields as Create a new external knowledge. Records are always created, not updated.
The batch is saved as a whole: if any record fails, nothing is saved and the error for that record is returned.
Maximum permitted batch size is 100.
POST
https://myorg.tribalhabits.com/papi
/
external_knowledges
/
batch_save
Batch create external knowledge
curl --request POST \
--url https://myorg.tribalhabits.com/papi/external_knowledges/batch_save \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"external_knowledges": [
{
"user_name": "johnny",
"title": "First Aid Certificate",
"provider": "Red Cross",
"type": "Certificate",
"date_obtained": "1/6/2021",
"expires": "1/6/2024"
},
{
"user_name": "mary",
"title": "Forklift Licence",
"provider": "WorkSafe",
"type": "License",
"date_obtained": "2023-03-15"
}
]
}
'import requests
url = "https://myorg.tribalhabits.com/papi/external_knowledges/batch_save"
payload = { "external_knowledges": [
{
"user_name": "johnny",
"title": "First Aid Certificate",
"provider": "Red Cross",
"type": "Certificate",
"date_obtained": "1/6/2021",
"expires": "1/6/2024"
},
{
"user_name": "mary",
"title": "Forklift Licence",
"provider": "WorkSafe",
"type": "License",
"date_obtained": "2023-03-15"
}
] }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
external_knowledges: [
{
user_name: 'johnny',
title: 'First Aid Certificate',
provider: 'Red Cross',
type: 'Certificate',
date_obtained: '1/6/2021',
expires: '1/6/2024'
},
{
user_name: 'mary',
title: 'Forklift Licence',
provider: 'WorkSafe',
type: 'License',
date_obtained: '2023-03-15'
}
]
})
};
fetch('https://myorg.tribalhabits.com/papi/external_knowledges/batch_save', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://myorg.tribalhabits.com/papi/external_knowledges/batch_save",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'external_knowledges' => [
[
'user_name' => 'johnny',
'title' => 'First Aid Certificate',
'provider' => 'Red Cross',
'type' => 'Certificate',
'date_obtained' => '1/6/2021',
'expires' => '1/6/2024'
],
[
'user_name' => 'mary',
'title' => 'Forklift Licence',
'provider' => 'WorkSafe',
'type' => 'License',
'date_obtained' => '2023-03-15'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}using RestSharp;
var options = new RestClientOptions("https://myorg.tribalhabits.com/papi/external_knowledges/batch_save");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "<api-key>");
request.AddJsonBody("{\n \"external_knowledges\": [\n {\n \"user_name\": \"johnny\",\n \"title\": \"First Aid Certificate\",\n \"provider\": \"Red Cross\",\n \"type\": \"Certificate\",\n \"date_obtained\": \"1/6/2021\",\n \"expires\": \"1/6/2024\"\n },\n {\n \"user_name\": \"mary\",\n \"title\": \"Forklift Licence\",\n \"provider\": \"WorkSafe\",\n \"type\": \"License\",\n \"date_obtained\": \"2023-03-15\"\n }\n ]\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
require 'uri'
require 'net/http'
url = URI("https://myorg.tribalhabits.com/papi/external_knowledges/batch_save")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"external_knowledges\": [\n {\n \"user_name\": \"johnny\",\n \"title\": \"First Aid Certificate\",\n \"provider\": \"Red Cross\",\n \"type\": \"Certificate\",\n \"date_obtained\": \"1/6/2021\",\n \"expires\": \"1/6/2024\"\n },\n {\n \"user_name\": \"mary\",\n \"title\": \"Forklift Licence\",\n \"provider\": \"WorkSafe\",\n \"type\": \"License\",\n \"date_obtained\": \"2023-03-15\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"created": 2,
"updated": 0,
"unchanged": 0
}{
"error": "Rate limit exceeded. Please slow down.",
"retry_after_seconds": 23
}Authorizations
Your organisation's API key, sent as Authorization: my_api_key. The key can also be passed as an api_key query parameter. See Authentication.
Body
application/json
An array of external knowledge objects
Maximum array length:
100Show child attributes
Show child attributes

