DeviceList

  • This method returns the latest device list details
  • Returns the following data:
    1. type
    2. vehicle
    3. serialNumber
    4. lastConnectedAt (UTC timestamp)

Use Case

  • Use to retrieve device details and last connection time

Use an HTTP GET request to obtain your list of devices:

[GET] https://secure.trackyourtruck.com/WebApi/api/v2.2/DeviceList

Request Header

The request header should contain the API Access Token obtained from the authentication process. Get Access Token.

Header Name Description
Authorization Access Token obtained from the 1st step's authentication process.

Create DeviceList Object

Below is the DeviceList request API examples:


var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization","Bearer YOUR_API_TOKEN")
var response = await client.GetAsync("https://secure.trackyourtruck.com/WebApi/api/v2.2/DeviceList");
var responseString = await response.Content.ReadAsStringAsync();
//responseString will contain the response in JSON format
$.ajax({
    beforeSend: function(xhrObj){
            xhrObj.setRequestHeader("Authorization","Bearer YOUR_API_TOKEN");
    },
    type: "GET",
    url: "https://secure.trackyourtruck.com/WebApi/api/v2.2/DeviceList",
    dataType: "json",
    success: function(data){
                    //data object will contain the result as a JSON object
    }
});

Sample DeviceList Object

$.ajax({
    beforeSend: function(xhrObj){
        xhrObj.setRequestHeader("Authorization","Bearer YOUR_API_TOKEN");
    },
    type: "GET",
    url: "https://secure.trackyourtruck.com/WebApi/api/v2.2/DeviceList",
    dataType: "json",
    success: function(data){
        //data object will contain the result as a JSON object
    }
});

A successful request will return the following JSON result:

{
    "StatusCode": "200",
    "Message": "OK",
    "pagination": {
        "PageNumber": 1,
        "PageSize": 100,
        "TotalRecords": 1250,
        "TotalPages": 13,
        "HasMore": true
    },
    "Results": [
        {
            "type": "tracker",
            "vehicle": "865",
            "serialNumber": "0604126598",
            "lastConnectedAt": "2025-01-06T03:24:53.000Z"
        }
    ]
}

Test

Test the DeviceList using your AccessToken by entering it below:

Clicking the test button will send a request to the TYT API and display the result below.