Authorization
The Legacy REST API uses Basic Authentication.
User setup
A user for REST API access must be set up in the TMS Control Panel:
- Go to the TMS Control Panel page
- Click "Users"
- On the upper tab, click "WEB Users"
- Click "Add WEB User"
- Under "Product", select "REST API" and enter the other details, most importantly email and password.
Headers
Given the email and password from the previous step, the Authorization
header can be prepared:
- Base64 encode the string
<email>:<password>
- Set the
Authorization
header toBasic
+ the encoded string from step 1
Most tools and frameworks will support Basic auth and prepare the correct headers given the email and password, for example:
Using Curl:
curl -u <email>:<password>
Using Python:
import requests
response = requests.get(
"https://myinstance.administrateapp.com/api/v2/crm/contacts",
auth=('<email>', '<password>')
)
Using PHP:
$url = 'https://myinstance.administrateapp.com/api/v2/crm/contacts';
$options = array(
'http' => array(
'method' => 'GET',
'header' => "Accept: application/json\r\n" .
"Authorization: Basic " . base64_encode($credentials)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);