GET
, POST
, PUT
and DELETE
which allow API users to retrieve, create, update and delete records within default and custom entities of CMDataManager. The HTTPS protocol should be used for all requests made to the API. All requests and responses are passed or returned in JSON format.
The flexibility of the CMDataManager API means that users can use it to develop brand new applications or integrate and establish data flows between CMDataManager and other existing applications.
For any further information regarding the API, please contact CMDataManager Support on: support@campaignmaster.co.uk.
/authenticate
endpoint, necessary to authorise the client with the CMDataManager platform and make requests to the other API endpoints:
{{api-url}}/api/{{api-version}}/authenticate
client_id: {{client-id}}
client_secret: {{client-secret}}
username: {{username}}
password: {{password}}
{
"token": "{{token}}"
}
var client = new RestClient("{{api-url}}/api/{{api-version}}/authenticate");
var request = new RestRequest(Method.POST);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("client_id", "client_id");
request.AddHeader("client_secret", "client_secret");
request.AddHeader("username", "username");
request.AddHeader("password", "password");
IRestResponse response = client.Execute(request);
$request = new HttpRequest();
$request->setUrl('{{api-url}}/api/{{api-version}}/authenticate');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'cache-control' => 'no-cache',
'client_id' => 'client_id',
'client_secret' => 'client_secret',
'username' => 'username',
'password' => 'password'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
Header | Details |
---|---|
x-rate-limit-limit | Integer value indicating the maximum number of calls per hour for the API user |
x-rate-limit-remaining | Integer value indicating the number of remaining calls per hour for the API user |
x-rate-limit-reset | Unix time indicating when the calls per hour limit will be reset |
x-token-reset | Unix time indicating when the authentication token will be reset |
GET
, POST
, UPDATE
, DELETE
. Each of the 4 types are described in further details below.
Method | Details |
---|---|
GET | Use to retrieve data from the server |
POST | Use to send new resources to the server |
PUT | Use to update existing resources |
DELETE | Use to delete resources |
Status Code | Details |
---|---|
200 OK | Returned when the API request is successful |
201 Created | Returned when the resource creation is successful |
400 Bad Request | Returned when there is a client error in the request e.g. malformed request syntax |
401 Unauthorized | Returned when authentication failed e.g. token missing/invalid |
404 Not Found | Returned when the resource cannot be found |
429 Too Many Requests | Returned when the limit of API requests per hour/month is reached |
500 Internal Server Error | Returned when an unexpected server error has occured |
account
, lead
, contact
, task
, opportunity
, custom entity
/{{entity}}/{{entity-external-id}}
// Authorization: Bearer {{token}}
string token
{
"ExternalID": "ABC1D2E3",
"Properties": {
"FieldName": "FieldValue",
"FieldName": "FieldValue"
}
}
var client = new RestClient("{{api-url}}/api/{{api-version}}/{{entity}}/{{entity-external-id}}");
var request = new RestRequest(Method.GET);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("Authorization", "Bearer {{token}}");
IRestResponse response = client.Execute(request);
$request = new HttpRequest();
$request->setUrl('{{api-url}}/api/{{api-version}}/{{entity}}/{{entity-external-id}}');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'cache-control' => 'no-cache',
'Authorization' => 'Bearer {{token}}'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
account
, lead
, contact
, task
, opportunity
, custom entity
/{{entity}}?fields={{fields}}&per_page={{per_page}}&page={{page}}&sort_by={{field}}&sort_order={{order}}
// Authorization: Bearer {{token}}
string token
// optional, comma-separated, example: e.g. fields=FirstName,LastName
string fields
// optional (required if page is used), example: e.g. per_page=10
string per_page
// optional (required if per_page is used), example: e.g. page=2
string page
// optional, example: e.g. sort_by=FirstName
string sort_by
// optional, example: e.g. sort_order=asc or sort_order=desc
string sort_order
{
"Total Records": "30",
"Total Pages": "3",
"Entity": [
{
"ExternalID": "ABC1D2E3",
"Properties": {
"FieldName": "FieldValue",
"FieldName": "FieldValue"
}
},
{
"ExternalID": "FGH4I5J6",
"Properties": {
"FieldName": "FieldValue",
"FieldName": "FieldValue"
}
}
]
}
var client = new RestClient("{{api-url}}/api/{{api-version}}/{{entity}}?fields={{fields}}&per_page={{per_page}}&page={{page}}");
var request = new RestRequest(Method.GET);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("Authorization", "Bearer {{token}}");
IRestResponse response = client.Execute(request);
$request = new HttpRequest();
$request->setUrl('{{api-url}}/api/{{api-version}}/{{entity}}?fields={{fields}}&per_page={{per_page}}&page={{page}}');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData(array(
'fields' => '{{fields}}',
'per_page' => '{{per_page}}',
'page' => '{{page}}'
));
$request->setHeaders(array(
'cache-control' => 'no-cache',
'Authorization' => 'Bearer {{token}}'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
account
, lead
, contact
, task
, opportunity
, custom entity
/{{entity}}
/{{entity}}/{{entity-external-id}}/task
/{{entity}}/{{entity-external-id}}/opportunity
Authorization: Bearer {{token}}
{
"FieldName": "FieldValue",
"FieldName": "FieldValue"
}
{
"ExternalID": "ABC1D2E3"
}
var client = new RestClient("{{api-url}}/api/{{api-version}}/{{entity}}");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer {{token}}");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("data", "{\"FieldName\":\"FieldValue\",\"FieldName\":\"FieldValue\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
$request = new HttpRequest();
$request->setUrl('{{api-url}}/api/{{api-version}}/{{entity}}');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Authorization' => 'Bearer {{token}}',
'Content-Type' => 'application/json'
));
$request->setBody('{"FieldName":"FieldValue","FieldName":"FieldValue"}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
account
, lead
, contact
, task
, opportunity
, custom entity
/{{entity}}/{{entity-external-id}}
Authorization: Bearer {{token}}
{
"FieldName": "FieldValue",
"FieldName": "FieldValue"
}
{
"Message": "Record updated."
}
var client = new RestClient("{{api-url}}/api/{{api-version}}/{{entity}}/{{entity-external-id}}");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer {{token}}");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("data", "{\"FieldName\":\"FieldValue\",\"FieldName\":\"FieldValue\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
$request = new HttpRequest();
$request->setUrl('{{api-url}}/api/{{api-version}}/{{entity}}/{{entity-external-id}}');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders(array(
'Authorization' => 'Bearer {{token}}',
'Content-Type' => 'application/json'
));
$request->setBody('{"FieldName":"FieldValue","FieldName":"FieldValue"}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
lead
/lead/convert/{{lead-external-id}}
Authorization: Bearer {{token}}
{
"Account ExternalID": "ABC1D2E3"
}
var client = new RestClient("{{api-url}}/api/{{api-version}}/lead/convert/{{entity-external-id}}");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer {{token}}");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("data", "{\"FieldName\":\"FieldValue\",\"FieldName\":\"FieldValue\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
$request = new HttpRequest();
$request->setUrl('{{api-url}}/api/{{api-version}}/lead/convert/{{entity-external-id}}');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders(array(
'Authorization' => 'Bearer {{token}}',
'Content-Type' => 'application/json'
));
$request->setBody('{"FieldName":"FieldValue","FieldName":"FieldValue"}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
task
/Task/Close/{{task-external-id}}
Authorization: Bearer {{token}}
{
"Message": "Record updated."
}
var client = new RestClient("{{api-url}}/api/{{api-version}}/task/close/{{task-external-id}}");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer {{token}}");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("data", "{\"FieldName\":\"FieldValue\",\"FieldName\":\"FieldValue\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
$request = new HttpRequest();
$request->setUrl('{{api-url}}/api/{{api-version}}/task/close/{{task-external-id}}');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders(array(
'Authorization' => 'Bearer {{token}}',
'Content-Type' => 'application/json'
));
$request->setBody('{"FieldName":"FieldValue","FieldName":"FieldValue"}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
account
, lead
, contact
, task
, opportunity
, custom entity
/{{entity}}/{{entity-external-id}}
// Authorization: Bearer {{token}}
string token
{
"Message": "Record deleted."
}
var client = new RestClient("{{api-url}}/api/{{api-version}}/{{entity}}/{{entity-external-id}}");
var request = new RestRequest(Method.DELETE);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("Authorization", "Bearer {{token}}");
IRestResponse response = client.Execute(request);
$request = new HttpRequest();
$request->setUrl('{{api-url}}/api/{{api-version}}/{{entity}}/{{entity-external-id}}');
$request->setMethod(METHOD_DELETE);
$request->setHeaders(array(
'cache-control' => 'no-cache',
'Authorization' => 'Bearer {{token}}'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
account
, lead
, contact
, opportunity
, custom entity
/{{entity}}/fields
// Authorization: Bearer {{token}}
string token
// optional (required if page is used), example: e.g. per_page=10
string per_page
// optional (required if per_page is used), example: e.g. page=2
string page
{
"Total Records": "30",
"Total Page": "3",
"Field": [
{
"ExternalID": "ABC1D2E3",
"Properties": {
"FieldName": "FieldValue",
"FieldName": "FieldValue"
}
},
{
"ExternalID": "FGH4I5J6",
"Properties": {
"FieldName": "FieldValue",
"FieldName": "FieldValue"
}
}
]
}
var client = new RestClient("{{api-url}}/api/{{api-version}}/{{entity}}/fields?per_page={{per_page}}&page={{page}}");
var request = new RestRequest(Method.GET);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("Authorization", "Bearer {{token}}");
IRestResponse response = client.Execute(request);
$request = new HttpRequest();
$request->setUrl('{{api-url}}/api/{{api-version}}/{{entity}}/fields?per_page={{per_page}}&page={{page}}');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData(array(
'per_page' => '10',
'page' => '1'
));
$request->setHeaders(array(
'cache-control' => 'no-cache',
'Authorization' => 'Bearer {{token}}'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}