Introduction
The following document describes the usage of the Scal-e API. You will find useful references and examples for all the available endpoints.
This documentation allows each application to retrieve data from the Scal-e instance, and to insert/update
data in the
Scal-e instance.
US Notation is used for date format (yyyy-mm-dd)
and decimal numbers (XX.XX)
instead of (XX,XX)
.
Environment URLs
- In a production instance the URI should follow this format
https://api.scal-e.com/<INSTANCE_ID>
. - In a demo production the URI should follow the format
https://api-demo.scal-e.com/<INSTANCE_ID>
. The instance_id parameter can be found as a configuration setting in your API profile, it enables you to communicate exclusively with your specific instance.
Environment | URL |
---|---|
API_URL | api.scal-e.com/v1/datamart |
DEMO_URL | api-demo.scal-e.com/v1/datamart |
Authentication
The authentication method is the Bearer authentication
. If you already have your own instance, please refer to the knowledge base to retrieve the necessary token. Alternatively, if you need to request a token, please contact us, and we will assist you further.
Data
Get Object List
Allows you to retrieve the list of available objects within your CDP (Customer Data Platform) based on the access rights defined in your API profile.
Request
GET https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_object_list
curl "curl --location --request GET 'https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_object_list' \
--header 'Authorization: Bearer <API_TOKEN>'"
import requests
url = "https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_object_list"
payload={}
headers = {
'Authorization': 'Bearer <API_TOKEN>'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_object_list',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer <API_TOKEN>'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'GET',
'hostname': '<API_URL>',
'path': '/v1/datamart/<INSTANCE_ID>/get_object_list',
'headers': {
'Authorization': 'Bearer <API_TOKEN>'
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
req.end();
Response
This function returns the list of Datamart objects associated with the API profile, including their creation and modification dates.
Response
{
"contact": {
"acl": "",
"create_time": "2022-10-25 16:45:09",
"update_time": "2023-01-27 01:19:17"
},
"orders": {
"acl": "",
"create_time": "2022-06-29 17:00:10",
"update_time": "2022-07-11 14:21:04"
},
"products": {
"acl": "",
"create_time": "2022-06-29 17:00:10",
"update_time": "2022-07-11 14:21:04"
}
}
Get Object Data
Allows you to retrieve records of a specific object. You can also add filters with selected criteria to retrieve specific records.
Request
GET https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_objects/<OBJECT_NAME>
OBJECT_NAME
is name of object
curl "curl --location --request GET 'https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_objects/<OBJECT_NAME>' \
--header 'Authorization: Bearer <API_TOKEN>'"
import requests
url = "https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_objects/<OBJECT_NAME>"
payload={}
headers = {
'Authorization': 'Bearer <API_TOKEN>'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_objects/<OBJECT_NAME>',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer <API_TOKEN>'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'GET',
'hostname': '<API_URL>',
'path': '/v1/datamart/<INSTANCE_ID>/get_objects/<OBJECT_NAME>',
'headers': {
'Authorization': 'Bearer <API_TOKEN>'
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
req.end();
Query parameters
Parameter | Type | Required | Descripion |
---|---|---|---|
fields | string | false | displays only the defined fields see fields |
limit | integer | false | limit the number of the records to sent |
offset | integer | false | specifies the number of data to skip before starting the response |
page | integer | Allows for search paging. Specifies the number of the expected page. Should be used as a complement to the 'pagesize' parameter see paging | |
pagesize | integer | false | specifies the pages size, must be used as page complement |
sort_by | allows to sort results by oneor many fields see ordering | ||
filter | string | false | allows to filter records see filtering |
Response
This function retrieves records of the specified object.
Response
{
"objects": [
{
"id": "109128",
"data": {
"Civilite": "Madame",
"Prenom": "John",
"Nom": "Doe",
"EMail": "johndoe@example.net",
"Pays": ""
}
},
{
"id": "110416",
"data": {
"Civilite": "Madame",
"Prenom": "John",
"Nom": "Doe",
"EMail": "johndoe@example.net",
"Pays": ""
}
}
]
}
Get Object Metadata
Retrieving object metadata will provide information concerning the fields associated with the object.
Request
GET https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_object_info/<OBJECT_NAME>
OBJECT_NAME
is the name of the specified object (idem get object data, idem create / update Object Data)
curl "curl --location --request GET 'https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_objects/<OBJECT_NAME>' \
--header 'Authorization: Bearer <API_TOKEN>'"
import requests
url = "https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_objects/<OBJECT_NAME>"
payload={}
headers = {
'Authorization': 'Bearer <API_TOKEN>'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_objects/<OBJECT_NAME>',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer <API_TOKEN>'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'GET',
'hostname': '<API_URL>',
'path': '/v1/datamart/<INSTANCE_ID>/get_objects/<OBJECT_NAME>',
'headers': {
'Authorization': 'Bearer <API_TOKEN>'
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
req.end();
Response
The function returns the field information of the specified object. Displays the information in an array.
Fields | Descripion |
---|---|
created_date | the creation date of the field |
modified_date | the last update date of the field |
label | field label |
description | field description |
type | field type |
length | variable length |
is_personal_data | specifies if the field is classified as a personal data field |
read | permission to access read |
write | permission to access write |
Response
{
"Adresse": {
"attribs": {
"created_date": "2018-07-28 16:31:28",
"modified_date": "2021-05-20 12:43:28",
"label": "",
"description": "",
"type": "text",
"length": "100",
"is_personal_data": "N"
},
"read": "Y",
"write": "Y"
},
"Civilite": {
"attribs": {
"created_date": "2018-07-28 16:31:28",
"modified_date": "2022-11-08 14:58:52",
"label": "",
"description": "",
"type": "choice",
"length": "16",
"is_personal_data": "N"
},
"read": "Y",
"write": "Y"
},
"CP": {
"attribs": {
"created_date": "2018-07-28 16:31:28",
"modified_date": "2019-10-17 15:25:14",
"label": "",
"description": "",
"type": "text",
"length": "50",
"is_personal_data": "N"
},
"read": "Y",
"write": "Y"
}
}
Create/Update Object Data
It is possible to create multiple new records and update them. The date format follows the US notation (yyyy-mm-dd), and decimal numbers are represented as XX.XX instead of XX,XX.
Request
The request is made to insert or modify a data object.
POST https://<API_URL>/v1/datamart/<INSTANCE_ID>/put_objects/<OBJECT_NAME>
OBJECT_NAME
is name of object
curl --location --request POST 'https://<API_URL>/v1/datamart/<INSTANCE_ID>/put_objects/<OBJECT_NAME>' \
--header 'Authorization: Bearer API_TOKEN' \
--form 'objects="[{\"Parameters\":{\"Variable\":\"Value\"}}]"'
import requests
url = "https://<API_URL>/v1/datamart/<INSTANCE_ID>/put_objects/<OBJECT_NAME>"
payload={'objects': '[{"Parameters":{"Variable":"Value"}}]'}
files=[
]
headers = {
'Authorization': 'Bearer API_TOKEN'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://%3CAPI_URL%3E/v1/datamart/%3CINSTANCE_ID%3E/put_objects/%3COBJECT_NAME%3E',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('objects' => '[{"Parameters":{"Variable":"Value"}}]'),
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer API_TOKEN'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://<API_URL>/v1/datamart/<INSTANCE_ID>/put_objects/<OBJECT_NAME>',
'headers': {
'Authorization': 'Bearer API_TOKEN'
},
formData: {
'objects': '[{"Parameters":{"Variable":"Value"}}]'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
Body
Key | Value |
---|---|
objects | [{"Parameters":{"Variable":"Value"}}] |
[{"Parameters":{"Variable":"Value"}}]
Additional variables, options, or records can be added separated by a comma.
Parameter | Descripion |
---|---|
data | variables are the different fields of the object This parameter is mandatory |
id | specified the ID of the record, to be used in case of an update. If the value is 0, then a new record will be created, else the record will be updated only if it already exists. Mandatory in case of an update |
link | this parameter allows to link the record to another direct object. You must add as a variable the linked object, and as a value, the identifier of the linked record in the linked object. Mandatory for links between objects |
It is possible to insert multiple records by framing them within a larger JSON structure in the request body.
Example
[
{"id":1,"link":{"contact":"47737"},
"data":{"DATE_DESINSCRIPTION":"2020-12-19 12:50:50","DESINSCRIPTION_ADRESSE":"exemple@example.com"}},
{"id":0,"link":{"contact":"49737"},
"data":{"DATE_DESINSCRIPTION":"2020-12-19 12:50:50","DESINSCRIPTION_ADRESSE":"exemple2@example.com"}},
{"id":2,"link":{"contact":"47738"},
"data":{"DATE_DESINSCRIPTION":"2020-12-19 12:50:50","DESINSCRIPTION_ADRESSE":"exemple3@example.com"}}
]
General
Paging
Number of page
GET https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_objects/<OBJECT>?limit=50&pagesize=30&page=3
OBJECT
the object to which paging will be applied
Query parameters
Parameter | Descripion |
---|---|
limit | page number |
pagesize | page size |
page | page number |
Ordering
Allows you to sort the results by one or multiple fields in either ascending (asc) or descending (desc) order.
GET https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_objects/<OBJECT>?sort_by="{"id_contact":"desc", "Nom":"asc"}
OBJECT
the object to which ordering will be applied
Query parameters
Parameter | Descripion |
---|---|
sort_by | The keys represent the fields of the object, and the values are either "asc" or "desc" |
Filtering
Filter your search by adding conditions in the query
filter=[field] operator value...operator [field] operator value...
GET https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_objects/<OBJECT>?filter=DateNaissance $gt "1990-06-12" $and EMail $like "*S*"
OBJECT
the object to which the filter will be applied
- Text values must be enclosed in quotation marks (").
- US Notation is used for the date format (yyyy-mm-dd) and decimal numbers (XX.XX) instead of XX,XX.
Operator | Description |
---|---|
$and | and |
$or | or |
* | matches character / string |
$like | allows you to search similar expression |
$notlike | allows you to search non similar expression |
$in | allows you to search a value contained in an enumeration [a,b,c] |
$notin | allows you to search a value which is not contained in an enumeration [a,b,c] |
$regex | allows you to use regular expression. Regex format : Mysql |
$eq | equal |
$gt | greater than |
$greater than or equal | greater than or equal |
$lt | lower than |
$lte | lower than or equal |
$neq | not equal |
Fields
Display the desired fields
GET https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_objects/<OBJECT>?fields=Civilite,Prenom,Nom,EMail,Telephone
OBJECT
the object whose fields we want to display
Example
Header parameters
Authorization: Bearer <ACCESS_TOKEN>
Insert data into an object not linked to another
Create an entry
POST https://<API_URL>/v1/datamart/<INSTANCE_ID>/put_objects/<OBJECT>
OBJECT
is name of object
curl --location --request POST 'https://<API_URL>/v1/datamart/<INSTANCE_ID>/put_objects/<OBJECT>' \
--header 'Authorization: Bearer API_TOKEN' \
--form 'objects="[{\"id\" : 0, \"data\" : {\"field_1\" : \"value_1\", \"field_2\" : \"value_2\"}}]"'
import requests
url = "https://<API_URL>/v1/datamart/<INSTANCE_ID>/put_objects/<OBJECT>"
payload={'objects': '[{"id" : 0, "data" : {"field_1" : "value_1", "field_2" : "value_2"}}]'}
files=[
]
headers = {
'Authorization': 'Bearer API_TOKEN'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://%3CAPI_URL%3E/v1/datamart/%3CINSTANCE_ID%3E/put_objects/%3COBJECT%3E',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('objects' => '[{"id" : 0, "data" : {"field_1" : "value_1", "field_2" : "value_2"}}]'),
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer API_TOKEN'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'POST',
'hostname': '<API_URL>',
'path': '/v1/datamart/<INSTANCE_ID>/put_objects/<OBJECT>',
'headers': {
'Authorization': 'Bearer API_TOKEN'
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"objects\"\r\n\r\n[{\"id\" : 0, \"data\" : {\"field_1\" : \"value_1\", \"field_2\" : \"value_2\"}}]\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--";
req.setHeader('content-type', 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW');
req.write(postData);
req.end();
Body
key | values |
---|---|
objects | [{"id" : 0, "data" : {"field_1" : "value_1", "field_2" : "value_2"}}] |
Response
{
"objects": [
{
"status": "OK",
"id": "<ID_ENTRY>",
"data": {
"field_1": "value_1",
"field_2": "value_2"
},
"updated": "N",
"created": "Y",
"found": "N"
}
]
}
Insert data into an object linked to another
Create an entry for object_1 (object_1 is linked to object_2)
object_1
is a CDP objectobject_2
is a CDP object
POST https://<API_URL>/v1/datamart/<INSTANCE_ID>/put_objects/<OBJECT>
OBJECT
is object_1 name to insert data
curl --location --request POST 'https://<API_URL>/v1/datamart/<INSTANCE_ID>/put_objects/<OBJECT>' \
--header 'Authorization: Bearer API_TOKEN' \
--form 'objects="[{\"id\" : 0, \"link\" : {\"object_2\" : id_object_2}, \"data\" : {\"field_1\" : \"value_1\", \"field_2\" : \"value_2\"}}]"'
import requests
url = "https://<API_URL>/v1/datamart/<INSTANCE_ID>/put_objects/<OBJECT>"
payload={'objects': '[{"id" : 0, "link" : {"object_2" : id_object_2}, "data" : {"field_1" : "value_1", "field_2" : "value_2"}}]'}
files=[
]
headers = {
'Authorization': 'Bearer API_TOKEN'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://%3CAPI_URL%3E/v1/datamart/%3CINSTANCE_ID%3E/put_objects/%3COBJECT%3E',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('objects' => '[{"id" : 0, "link" : {"object_2" : id_object_2}, "data" : {"field_1" : "value_1", "field_2" : "value_2"}}]'),
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer API_TOKEN'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://<API_URL>/v1/datamart/<INSTANCE_ID>/put_objects/<OBJECT>',
'headers': {
'Authorization': 'Bearer API_TOKEN'
},
formData: {
'objects': '[{"id" : 0, "link" : {"object_2" : id_object_2}, "data" : {"field_1" : "value_1", "field_2" : "value_2"}}]'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
Body
key | values |
---|---|
objects | [{"id" : 0, "link" : {"object_2" : id_object_2}, "data" : {"field_1" : "value_1", "field_2" : "value_2"}}] |
field_1
is a field of object_1field_2
is a field of object_1
Response
{
"objects": [
{
"status": "OK",
"id": "<ID_ENTRY>",
"data": {
"object_1.field_1": "value_1",
"object_1.field_2": "value_2"
},
"link": {
"object_2" : "id_object_2"
},
"updated": "N",
"created": "Y",
"found": "N"
}
]
}
Update data
Update an order detail
POST https://<API_URL>/v1/datamart/<INSTANCE_ID>/put_objects/<OBJECT>
OBJECT
is object name to update
curl --location --request POST 'https://<API_URL>/v1/datamart/<INSTANCE_ID>/put_objects/<OBJECT>' \
--header 'Authorization: Bearer API_TOKEN' \
--form 'objects="[{\"id\" : id_\\<OBJECT\\>, \"data\" :{\"field_1\" : \"value_1\", \"field_2\" : \"value_2\"}}]"'
import requests
url = "https://<API_URL>/v1/datamart/<INSTANCE_ID>/put_objects/<OBJECT>"
payload={'objects': '[{"id" : id_\\<OBJECT\\>, "data" :{"field_1" : "value_1", "field_2" : "value_2"}}]'}
files=[
]
headers = {
'Authorization': 'Bearer API_TOKEN'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://%3CAPI_URL%3E/v1/datamart/%3CINSTANCE_ID%3E/put_objects/%3COBJECT%3E',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('objects' => '[{"id" : id_\\<OBJECT\\>, "data" :{"field_1" : "value_1", "field_2" : "value_2"}}]'),
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer API_TOKEN'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://%3CAPI_URL%3E/v1/datamart/%3CINSTANCE_ID%3E/put_objects/%3COBJECT%3E',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('objects' => '[{"id" : id_\\<OBJECT\\>, "data" :{"field_1" : "value_1", "field_2" : "value_2"}}]'),
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer API_TOKEN'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Body
key | values |
---|---|
objects | [{"id" : id_<OBJECT>, "data" :{"field_1" : "value_1", "field_2" : "value_2"}}] |
Response
{
"objects": [
{
"status": "OK",
"id": "id_<OBJECT>",
"data": {
"field_1": "value_1",
"field_2": "value_2"
},
"updated": "Y",
"created": "N",
"found": "Y"
}
]
}
Display per page
Display page 10 of contacts. A page contains 5 records
GET https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_objects/<OBJECT>?page=10&pagesize=5
OBJECT
is a CDP object
curl --location --request GET 'GET https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_objects/<OBJECT>?page=10&pagesize=5' \
--header 'Authorization: Bearer API_TOKEN' \
--form 'objects="[{\"id\" : id_\\<OBJECT\\>, \"data\" :{\"field_1\" : \"value_1\", \"field_2\" : \"value_2\"}}]"'
import requests
url = "GET https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_objects/<OBJECT>?page=10&pagesize=5"
payload={'objects': '[{"id" : id_\\<OBJECT\\>, "data" :{"field_1" : "value_1", "field_2" : "value_2"}}]'}
files=[
]
headers = {
'Authorization': 'Bearer API_TOKEN'
}
response = requests.request("GET", url, headers=headers, data=payload, files=files)
print(response.text)
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'GET%20https://%3CAPI_URL%3E/v1/datamart/%3CINSTANCE_ID%3E/get_objects/%3COBJECT%3E?page=10&pagesize=5',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_POSTFIELDS => array('objects' => '[{"id" : id_\\<OBJECT\\>, "data" :{"field_1" : "value_1", "field_2" : "value_2"}}]'),
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer API_TOKEN'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'GET https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_objects/<OBJECT>?page=10&pagesize=5',
'headers': {
'Authorization': 'Bearer API_TOKEN'
},
formData: {
'objects': '[{"id" : id_\\<OBJECT\\>, "data" :{"field_1" : "value_1", "field_2" : "value_2"}}]'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
Response
{
"objects": [
{
"id": "49049",
"data": {
"field_1": "value_1_1",
"field_2": "value_1_2",
"field_n": "value_1_n",
"ID_<OBJECT>": "49049"
}
},
{
"id": "49092",
"data": {
"field_1": "value_2_1",
"field_2": "value_2_1",
"field_n": "value_2_n",
"ID_<OBJECT>": "49049"
}
},
{
"id": "49204",
"data": {
"field_1": "value_3_1",
"field_2": "value_3_2",
"field_n": "value_3_n",
"ID_<OBJECT>": "49049"
}
}
]
}
Filter data
Orders under 10 €
GET https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_objects/<OBJECT>?filter=field_1 operator "value_1"
curl --location --request GET 'GET https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_objects/<OBJECT>?filter=field_1 operator "value_1"' \
--header 'Authorization: Bearer API_TOKEN' \
--form 'objects="[{\"id\" : id_\\<OBJECT\\>, \"data\" :{\"field_1\" : \"value_1\", \"field_2\" : \"value_2\"}}]"'
import requests
url = "GET https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_objects/<OBJECT>?filter=field_1 operator \"value_1\""
payload={'objects': '[{"id" : id_\\<OBJECT\\>, "data" :{"field_1" : "value_1", "field_2" : "value_2"}}]'}
files=[
]
headers = {
'Authorization': 'Bearer API_TOKEN'
}
response = requests.request("GET", url, headers=headers, data=payload, files=files)
print(response.text)
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'GET%20https://%3CAPI_URL%3E/v1/datamart/%3CINSTANCE_ID%3E/get_objects/%3COBJECT%3E?filter=field_1%20operator%20%22value_1%22',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_POSTFIELDS => array('objects' => '[{"id" : id_\\<OBJECT\\>, "data" :{"field_1" : "value_1", "field_2" : "value_2"}}]'),
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer API_TOKEN'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'GET https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_objects/<OBJECT>?filter=field_1 operator "value_1"',
'headers': {
'Authorization': 'Bearer API_TOKEN'
},
formData: {
'objects': '[{"id" : id_\\<OBJECT\\>, "data" :{"field_1" : "value_1", "field_2" : "value_2"}}]'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
Response
"objects": [
{
"id": "47737",
"data": {
"field_1": "value3_1",
"field_2": "value3_2",
"field_n": "value3_n",
"ID_<OBJECT>": "49049"
}
},
{
"id": "247173",
"data": {
"field_1": "value3_1",
"field_2": "value3_2",
"field_n": "value3_n",
"ID_<OBJECT>": "49049"
}
},
{
"id": "48022",
"data": {
"field_1": "value3_1",
"field_2": "value3_2",
"field_n": "value3_n",
"ID_<OBJECT>": "49049"
}
}
]
Sort data
Display all contacts sorted by ascending name
GET https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_objects/<OBJECT>?sort_by={"field_1":"asc"}
curl --location -g --request GET 'GET https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_objects/<OBJECT>?sort_by={"field_1":"asc"}' \
--header 'Authorization: Bearer API_TOKEN' \
--form 'objects="[{\"id\" : id_\\<OBJECT\\>, \"data\" :{\"field_1\" : \"value_1\", \"field_2\" : \"value_2\"}}]"'
import requests
url = "GET https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_objects/<OBJECT>?sort_by={\"field_1\":\"asc\"}"
payload={'objects': '[{"id" : id_\\<OBJECT\\>, "data" :{"field_1" : "value_1", "field_2" : "value_2"}}]'}
files=[
]
headers = {
'Authorization': 'Bearer API_TOKEN'
}
response = requests.request("GET", url, headers=headers, data=payload, files=files)
print(response.text)
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'GET%20https://%3CAPI_URL%3E/v1/datamart/%3CINSTANCE_ID%3E/get_objects/%3COBJECT%3E?sort_by=%7B%22field_1%22:%22asc%22%7D',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_POSTFIELDS => array('objects' => '[{"id" : id_\\<OBJECT\\>, "data" :{"field_1" : "value_1", "field_2" : "value_2"}}]'),
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer API_TOKEN'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'GET https://<API_URL>/v1/datamart/<INSTANCE_ID>/get_objects/<OBJECT>?sort_by={"field_1":"asc"}',
'headers': {
'Authorization': 'Bearer API_TOKEN'
},
formData: {
'objects': '[{"id" : id_\\<OBJECT\\>, "data" :{"field_1" : "value_1", "field_2" : "value_2"}}]'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
Response
"objects": [
{
"id": "47737",
"data": {
"field_1": "value_1_1",
"field_2": "value_2_2",
"field_n": "value_3_n",
"ID_<OBJECT>": "49049"
}
},
{
"id": "247173",
"data": {
"field_1": "value_2_1",
"field_2": "value_3_2",
"field_n": "value3_n",
"ID_<OBJECT>": "49049"
}
},
{
"id": "48022",
"data": {
"field_1": "value_3_1",
"field_2": "value_3_2",
"field_n": "value_3_n",
"ID_<OBJECT>": "49049"
}
}
]
Status codes
The Scal-e API uses the following error codes
Code | Message | Meaning |
---|---|---|
200 | OK | Your request was processed successfully |
201 | Created | Instance has been created successfully |
400 | Bad Request | Your request is invalid |
401 | Unauthorized | Your API key is wrong |
403 | Forbidden | The requested is for administrators only |
404 | Not Found | The specified request could not be found |
405 | Method Not Allowed | You tried to access a request with an invalid method |
406 | Not Acceptable | You requested a format that isn't json |
429 | Too Many Requests | You're requesting too many Slow down! |
500 | Internal Server Error | We had a problem with our server |
503 | Service Unavailable | We're temporarily offline for maintenance |