Ctrack Maxx API
4.0.4.257
API for ctrack
|
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:
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.
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.
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:
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.
Our next step will be to use the GetVehicleMappingsByVehicleRegistrationsRest method of the TrackingUnit service to retrieve a list of the vehicles available to us.
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.)