Two steps are enough: log in with your API key, then use the returned Auth token to call any function.
Call the Login function and send your API key as a Bearer token. The response contains the Auth token that you use in every other request.
https://rest.crmango.com/api/Login
curl --request GET \
--url 'https://rest.crmango.com/api/Login' \
--header 'Authorization: Bearer your-api-key'
$apikey = 'your-api-key';
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://rest.crmango.com/api/Login',
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 ' . $apikey . ''
),
));
$response = curl_exec($curl);
$response = json_decode($response, true);
// Save Auth Token from Login function
$auth_token = $response['auth_token'];
const apikey = 'your-api-key';
const response = await fetch('https://rest.crmango.com/api/Login', {
method: 'GET',
headers: { 'Authorization': `Bearer ${apikey}` },
});
const data = await response.json();
// Save Auth Token from Login function
const authToken = data.auth_token;
import requests
apikey = 'your-api-key'
response = requests.get(
'https://rest.crmango.com/api/Login',
headers={'Authorization': f'Bearer {apikey}'},
)
# Save Auth Token from Login function
auth_token = response.json()['auth_token']
{
"code": 200,
"auth_token": "7f23e6csdf231f91d572458sd2283Df097a1f14ed011e4a9520a8dd10aa3ef82789"
}
Send the Auth token as a Bearer token and call any function. This example gets all activities and prints them.
https://rest.crmango.com/api/GetAllActivities
curl --request GET \
--url 'https://rest.crmango.com/api/GetAllActivities' \
--header 'Authorization: Bearer your-auth-token'
// Get all activities
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://rest.crmango.com/api/GetAllActivities',
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 ' . $auth_token . ''
),
));
$all_activities = curl_exec($curl);
// Print all activities
print_r($all_activities);
// Get all activities
const response = await fetch('https://rest.crmango.com/api/GetAllActivities', {
method: 'GET',
headers: { 'Authorization': `Bearer ${authToken}` },
});
const allActivities = await response.json();
// Print all activities
console.log(allActivities);
# Get all activities
response = requests.get(
'https://rest.crmango.com/api/GetAllActivities',
headers={'Authorization': f'Bearer {auth_token}'},
)
# Print all activities
print(response.json())
{
"code": 200,
"response": [
{
"id": 48213,
"note": "Phone call - offer follow-up",
"timefrom": 1792398600,
"timeto": 1792399800,
"date": 1792368000,
"source": "",
"type_id": 1,
"userid": 7,
"company_id": 1204,
"orderid": 0,
"person_id": 311,
"company_name": "Alfa Stav s.r.o.",
"updated_at": 1792399920
},
{
"id": 48214,
"note": "Site visit, Bratislava",
"timefrom": 1792404000,
"timeto": 1792412100,
"date": 1792368000,
"source": "GPS tracker",
"type_id": 4,
"userid": 7,
"company_id": 1187,
"orderid": 5521,
"person_id": 298,
"company_name": "Bytservis Plus a.s.",
"updated_at": 1792412400
},
{
"id": 48230,
"note": "Contract preparation",
"timefrom": 1792501200,
"timeto": 1792506600,
"date": 1792454400,
"source": "",
"type_id": 2,
"userid": 12,
"company_id": 1204,
"orderid": 5530,
"person_id": 311,
"company_name": "Alfa Stav s.r.o.",
"updated_at": 1792506660
}
]
}