StopTime

  • This method is associated with the “Stop Time” Report in NetTrack and contains all Stop events and associated Stop Times
  • Returns following information:
    • Vehicle Key Off and Key On Events with Date/Time
    • Location/Address of Event
    • Total Stop Time
    • Total Miles between Last Stop and Current Stop

Use Case

  • Use to query Stop history with Location Date/Time, Stop Time and Mileage between Stops

Use an HTTP POST request to obtain your vehicle's Stop Time:

[POST] https://secure.trackyourtruck.com/WebApi/api/v2.0/StopTime

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.

Request Parameters

The Request should contain the following parameters:

Parameter Name Description Value Format Example
FromDateTime Beginning Date/Time for your query* MM/dd/yyyy hh:mm tt 08/08/2018 05:00 AM
ToDateTime Ending Date/Time for your query* MM/dd/yyyy hh:mm tt 08/08/2018 11:00 PM
Is12HrsFormat "True" value for 12-Hour formatting of time;
"False"/"Blank" for 24-Hour formatting
true or false true
StopTimeMoreThan (Optional) Filter by minimum Stop Time numeric (Minutes) 25
VehicleId (Optional) Filter by a specific VehicleID numeric 825

* Date/Time will return all matching events without consideration of Vehicle Time Zone. However, the Event Time returned will include the Time Zone designation.

Create StopTime Object

Below is the StopTime request API examples:


var client = new HttpClient();
var values = new Dictionary
    {
        { "FromDateTime", "08/08/2018 05:00 AM"  },
        { "ToDateTime", "08/08/2018 11:00 PM" },
        { "Is12HrsFormat", true },
        { "StopTimeMoreThan", "25" },
        { "VehicleId","845" }
    };
    client.DefaultRequestHeaders.Add("Authorization","Bearer YOUR_API_TOKEN")
    var content = new FormUrlEncodedContent(values);
    var response = await client.PostAsync("https://secure.trackyourtruck.com/WebApi/api/v2.0/StopTime", content);
    var responseString = await response.Content.ReadAsStringAsync();

//responseString will contain a Credential Object in JSON format
$.ajax({
    beforeSend: function(xhrObj){
            xhrObj.setRequestHeader("Authorization","Bearer YOUR_API_TOKEN");
    },
    type: "POST",
    url: "https://secure.trackyourtruck.com/WebApi/api/v2.0/StopTime",
    dataType: "json",
    data:{
        FromDateTime : "08/08/2018 05:00 AM" ,
        ToDateTime: "08/08/2018 11:00 PM",
        Is12HrsFormat: true,
        StopTimeMoreThan: "25",
        VehicleId: "845"
    },
    success: function(data){
                    //data object will contain the result as a JSON object
    }
});

Sample StopTime Object

$.ajax({
    beforeSend: function(xhrObj){
            xhrObj.setRequestHeader("Authorization","Bearer YOUR_API_TOKEN");
    },
    type: "POST",
    url: "https://secure.trackyourtruck.com/WebApi/api/v2.0/StopTime",
    dataType: "json",
    data:{
        FromDateTime : "08/08/2018 05:00 AM" ,
        ToDateTime: "08/08/2018 11:00 PM",
        Is12HrsFormat: true,
        StopTimeMoreThan: "25",
        VehicleId: "845"
    },
    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":[
        {
            "VehicleName": "Alison-4509",
            "KeyOff": "08/01/2018 14:12:26 (EST)",
            "NextKeyOn": "08/01/2018 14:20:46 (EST)",
            "Location": "1214 Lakepointe Drive, Forest, VA 24551",
            "StopTime": "00:08:20",
            "Miles": "0.0"
        },
        {
            "VehicleName": "Alison-4509",
            "KeyOff": "08/01/2018 15:21:01 (EST)",
            "NextKeyOn": "08/01/2018 16:28:03 (EST)",
            "Location": "1214 Lakepointe Drive, Forest, VA 24551",
            "StopTime": "01:07:02",
            "Miles": "10.7"
        },
        {
            "VehicleName": "Alison-4509",
            "KeyOff": "08/01/2018 16:49:47 (EST)",
            "NextKeyOn": "08/01/2018 17:12:03 (EST)",
            "Location": "4024 Wards Road, Lynchburg, VA 24502",
            "StopTime": "00:22:16",
            "Miles": "11.3"
        },
        .............
        .............
        .............
    ]
    }

Test

Test the StopTime using your AccessToken by entering it below:

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