Truck Activity Summary

  • This method will return the “Truck Activity Summary” based on vehicle ID and date range.
  • Returns following information:
    • Vehicle Total Operating Time
    • Vehicle Total Stand Still Time
    • Vehicle Total Stop Time
    • Vehicle Total Miles

Use Case

  • Use the query to get Truck Activity Summary

Use an HTTP POST request to obtain your vehicle's Truck Activity Summary:

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

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 06/23/2024 12:00 AM
ToDateTime Ending Date/Time for your query* MM/dd/yyyy hh:mm tt 07/03/2024 11:59 PM
Is12HrsFormat "True" value for 12-Hour formatting of time;
"False"/"Blank" for 24-Hour formatting
true or false true
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 TruckActivitySummary Object

Below is the TruckActivitySummary request API examples:


var client = new HttpClient();
var values = new Dictionary
    {
    { "FromDateTime", "06/23/2024 12:00 AM"  },
    { "ToDateTime", "07/03/2024 11:59 PM" },
    { "Is12HrsFormat", true },
    { "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.2/TruckActivitySummary", 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.2/TruckActivitySummary",
    dataType: "json",
    data:{
        FromDateTime : "06/23/2024 12:00 AM" ,
        ToDateTime: "07/03/2024 11:59 PM",
        Is12HrsFormat: true,
        VehicleId: "845"
    },
    success: function(data){
                    //data object will contain the result as a JSON object
    }
});

Sample TruckActivitySummary Object

$.ajax({
    beforeSend: function(xhrObj){
            xhrObj.setRequestHeader("Authorization","Bearer YOUR_API_TOKEN");
    },
    type: "POST",
    url: "https://secure.trackyourtruck.com/WebApi/api/v2.2/TruckActivitySummary",
    dataType: "json",
    data:{
        FromDateTime : "06/23/2024 12:00 AM" ,
        ToDateTime: "07/03/202024 11:59 PM",
        Is12HrsFormat: true,
        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":[
    {
        "VehicleId": 15818,
        "VehicleName": "Alison-4509",
        "FromDate": "06/23/2024 00:00",
        "ToDate": "07/03/2024 23:59",
        "TotalOperatingTime": "21:23:47",
        "TotalStandStillTime": "01:47:15",
        "TotalStopTime": "230:48:02",
        "TotalMiles": "535.3"
    },
    {
        "VehicleId": 18279,
        "VehicleName": "Hunter 2017 Elantra ",
        "FromDate": "06/23/2024 00:00",
        "ToDate": "07/03/2024 23:59",
        "TotalOperatingTime": "21:04:02",
        "TotalStandStillTime": "00:56:43",
        "TotalStopTime": "678:20:07",
        "TotalMiles": "504.8"
    },
    {
        "VehicleId": 26386,
        "VehicleName": "RJH Sienna--ATT--MCX1M1--4998",
        "FromDate": "06/23/2024 00:00",
        "ToDate": "07/03/2024 23:59",
        "TotalOperatingTime": "19:16:45",
        "TotalStandStillTime": "00:54:23",
        "TotalStopTime": "560:02:30",
        "TotalMiles": "603.3"
    },
    .............
    .............
    .............
    ]
    }

Test

Test the TruckActivitySummary using your AccessToken by entering it below:

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