CurrentStatusAndLastLocation

  • This method contains the latest, most up-to-date vehicle information and provides most developers with all the necessary information for a basic tracking API integration
  • Returns two pieces of information:
    1. Vehicle Status with Location, which is a Status Event triggered by the Vehicle. Examples include Key On, Key Off, Arrive/Leave a Point, Harsh Braking, et. Al. For a complete list, click here. Included with the Status is the Status Location (GPS location)
    2. Last Known Vehicle Location, which is usually NOT the same location as the Status Location (ex. Vehicle trips Key On and then continues to drive and send updated GPS Locations)

Use Case

  • Use to query the latest Status with Status Location, Date, Time
  • Use to query latest Vehicle Location with Location, Date, Time

Use an HTTP GET request to obtain your vehicles' Current Status and Last Location:

[GET] https://secure.trackyourtruck.com/WebApi/api/v2.0/CurrentStatusAndLastLocation/{Vehicle_ID}

Request Header

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

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

URL Parameter

If you want to receive Current Status and Latest Vehicle Location for a specific vehicle, the URL should contain the VehicleID parameter below.

Parameter Name Description
Vehicle ID (Optional) To get the Current Status and Location of a specific vehicle.

Create CurrentStatusAndLastLocation Object

Below is the CurrentStatusAndLastLocation 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.0/CurrentStatusAndLastLocation");
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.0/CurrentStatusAndLastLocation",
    dataType: "json",
    success: function(data){
                    //data object will contain the result as a JSON object
    }
});

Sample CurrentStatusAndLastLocation Object

$.ajax({
    beforeSend: function(xhrObj){
        xhrObj.setRequestHeader("Authorization","Bearer YOUR_API_TOKEN");
    },
    type: "GET",
    url: "https://secure.trackyourtruck.com/WebApi/api/v2.0/CurrentStatusAndLastLocation",
    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",
    "Data":[
        {
            "VehicleId": 5835,
            "VehicleName": "24/7--CalAmp-RACO-SIM-641",
            "TimeZone": "CST",
            "VehicleStatusCode": "83",
            "VehicleStatus": "Key Off (IS)",
            "IntelliStatus": "IS",
            "StatusTime": "03/14/2016 10:52:51",
            "Lat": 41.49297,
            "Lon": -87.92036,
            "MoveTime": "03/14/2016 10:52:51",
            "Address1": "Address Not Resolved",
            "City": "",
            "State": "",
            "Zip": ""
        },
        {
            "VehicleId": 7920,
            "VehicleName": "Samar-3843-T",
            "TimeZone": "CST",
            "VehicleStatusCode": "83",
            "VehicleStatus": "Key Off (IS)",
            "IntelliStatus": "IS",
            "StatusTime": "07/22/2018 14:29:45",
            "Lat": 41.89565,
            "Lon": -87.80007,
            "MoveTime": "07/22/2018 14:31:34",
            "Address1": "532 Forest Avenue",
            "City": "Oak Park",
            "State": "IL",
            "Zip": "60302"
        },
        {
            "VehicleId": 8601,
            "VehicleName": ".129--24/7-1x-KORE-CDMA--129DELPHIlistener",
            "TimeZone": "CST",
            "VehicleStatusCode": "08",
            "VehicleStatus": "Arrive (New Test)",
            "IntelliStatus": "I-2364286",
            "StatusTime": "03/09/2017 10:20:31",
            "Lat": 37.35865,
            "Lon": -79.23948,
            "MoveTime": "07/23/2018 07:06:58",
            "Address1": "630 Wyndhurst Drive",
            "City": "Lynchburg",
            "State": "VA",
            "Zip": "24502"
        },
        .............
        .............
        .............
        ]
    }

Test

Test the CurrentStatusAndLastLocation using your AccessToken by entering it below:

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