Authentication

  • You will need to obtain an Access Token in order to access the API
  • You can authenticate using either the provided Client ID and PIN, or your system credentials: login and password
  • IMPORTANT: The Access Token expires in 24 hours from the time you create it. You will need to request a new token every 24 hours
  • We use OAuth 2.0 Bearer Token authentication.

Use Case

  1. Obtain your ClientID and API PIN# from our support department. Create a Support Ticket
  2. Using your ClientID and API PIN#, create your Access Token
[POST] https://secure.trackyourtruck.com/WebApi/api/v2.2/Token

Request Parameters

Below parameters should be included in the request to get your Access Token

Parameter Name Description
ClientId ClientID supplied by the TYT support department. You may also pass Login here.
Pin Pin supplied by the TYT support department. You may also pass Password here.

Create Credentials object

Once you receive your ClientId and PIN from TYT Support, you can create an Access Token using an HTTP POST request. Below is a sample request:


var client = new HttpClient();
var values = new Dictionary
{
   { "ClientId", "[YOUR_CLIENT_ID]" },
   { "Pin", "[YOUR_PIN]" }
};
var content = new FormUrlEncodedContent(values);
var response = await client.PostAsync("https://secure.trackyourtruck.com/WebApi/api/v2.2/Token", content);
var responseString = await response.Content.ReadAsStringAsync();
//responseString will contain a Credential Object in JSON format
$.post("https://secure.trackyourtruck.com/WebApi/api/v2.2/Token", 
{ 
    ClientId : [YOUR_CLIENT_ID],
    Pin: [YOUR_PIN]
}, 
function (data) {
    //data object will contain the response as a JSON object.
});

Sample Credentials object

$.post("https://secure.trackyourtruck.com/WebApi/api/v2.2/Token", 
{ 
    ClientId : [YOUR_CLIENT_ID],
    Pin: [YOUR_PIN]
}, 
function (data) {
        //data object will contain the response as a JSON object.
});

You can also use employee credentials by passing Login in ClientId and Password in Pin:

$.post("https://secure.trackyourtruck.com/WebApi/api/v2.2/Token", 
{ 
    ClientId : [LOGIN],
    Pin: [PASSWORD]
}, 
function (data) {
        //data object will contain the response as a JSON object.
});

A successful request will return the following JSON result:

{
    "StatusCode": "200",
    "Message": "OK",
    "Data": {
            "Token":"cc4d35e4b4244e5b8b3cf10da2ef37a4",
            "ClientId": "613",
            "ClientName": "Cemtek Com, Inc.- 24-7 Monitoring"
        }
}

Test

Test the Access Token using the test ClientID and PIN below or use the one you obtained from TYT Support by entering each in the respective fields below:

  • Test ClientID: 613
  • Test PIN: 613