Ctrack Maxx API  4.0.4.257
API for ctrack
REST Quickstart

This introductory document demonstrates how to use tools such as Postman to retrieve JSON-formatted data from the API.

The Ctrack External API is divided into three services:

  • The Membership service, providing information relating to the user, such as their membership of the available business groups.
  • The TrackingUnit service, providing information and actions relating to the tracking units installed.
  • The Drivers service, providing information and actions relating to drivers.

Each service exposes WCF endpoints that return XML data via SOAP 1.2, and counterparts that return JSON.
If you wish to use a WCF Web Service to access data via SOAP, refer to the SOAP Quickstart guide instead.

Given a WCF service endpoint ~/Membership.svc/AcquireSecurityToken, the JSON equivalent may be found at ~/Membership.svc/Rest/AcquireSecurityTokenRest.

REST API Demonstration - Retrieving Odometer Readings

Most of the information available via the API is accessed by providing the relevant API call with a valid token and the ID of the associated entity (usually a vehicle or driver ID).

In this example, we will demonstrate one way of retrieving odometer data for a specific vehicle.

Step 1 : Acquire a security token

A security token is required for all web service calls. We can get one using AcquireSecurityTokenRest and a valid username and password.

To do this, use a web browser or tool of your choice (we like Postman) to send a GET request to the following URL:

https://sales.ctrack.co.uk/ctrackapi/membership.svc/rest/acquiresecuritytokenrest?username=demo&password=demo

You should recieve a response similar to the following:

{
       "AcquireSecurityTokenRestResult": {  
               "SecurityToken":"d63cdf94-fd3e-4b49-aaad-4ed23f0a07c3",
               "SessionLength":600000,
               "APIVersion":"1.0"
      }
}

This is your security token, which will be used to access data in future requests. If it is not used for ten minutes it will expire and you (or rather, your client) will need to authenticate again.


Step 2 : Retrieve a list of vehicles

Our next step will be to use the GetVehicleMappingsByVehicleRegistrationsRest method of the TrackingUnit service to retrieve a list of the vehicles available to us.


Step 4 : Find vehicle odometer readings

We are going to use GetVehicleCurrentRunningDataByIdsRest to get readings from the odometers of multiple vehicles. The call takes two parameters: a valid security token and a list of vehicle ID's to look up (found using the previous call.)