PointActivity

  • This method is associated with the “Point Activity” Report in NetTrack and contains all Arrival and Departure events for customer entered Points/Geofences
  • Returns following information:
    • Point/Geofence Name with Vehicle Arrival/Departure date/time
    • Time Vehicle spent at Point/Geofence
    • Event Type: Arrival/Departure

Use Case

  • Use to query Point Activity history with Location Date/Time

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

[POST] https://secure.trackyourtruck.com/WebApi/api/v2.1/PointActivity?IsUtcTimeZone={IsUtcTimeZone}

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
PointId (Optional) Filter by a specific PointId numeric 6113
VehicleId (Optional) Filter by a specific VehicleID numeric 825
IsUtcTimeZone (optional) "True" returns Event Time in UTC
"False"/"Blank" returns Event Time in Vehicle Time Zone
true or false true

* 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 PointActivity Object

Below is the PointActivity 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" },
        { "PointId", "6113" },
        { "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.1/PointActivity", 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.1/PointActivity",
    dataType: "json",
    data:{
        FromDateTime : "08/08/2018 05:00 AM" ,
        ToDateTime: "08/08/2018 11:00 PM",
        Is12HrsFormat: true,
        PointId: "6113",
        VehicleId: "845"
    },
    success: function(data){
                    //data object will contain the result as a JSON object
    }
});

Sample PointActivity Object

$.ajax({
    beforeSend: function(xhrObj){
            xhrObj.setRequestHeader("Authorization","Bearer YOUR_API_TOKEN");
    },
    type: "POST",
    url: "https://secure.trackyourtruck.com/WebApi/api/v2.1/PointActivity",
    dataType: "json",
    data:{
        FromDateTime : "08/08/2018 05:00 AM" ,
        ToDateTime: "08/08/2018 11:00 PM",
        Is12HrsFormat: true,
        PointId: "6113",
        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":[
            {
                "PointName": "Office 1",
                "DateTime": "08/02/2018 19:26:45 (EST)",
                "VehicleName": "Alison-4509",
                "Event": "Arrive",
                "TimeAtPoint": ""
            },
            {
                "PointName": "Office 1",
                "DateTime": "08/02/2018 19:43:49 (EST)",
                "VehicleName": "Alison-4509",
                "Event": "Leave",
                "TimeAtPoint": "00:17:04"
            },
            {
                "PointName": "Office 2",
                "DateTime": "08/01/2018 15:19:58 (EST)",
                "VehicleName": "Alison-4509",
                "Event": "Arrive",
                "TimeAtPoint": ""
            },
            {
                "PointName": "Office 2",
                "DateTime": "08/01/2018 16:30:02 (EST)",
                "VehicleName": "Alison-4509",
                "Event": "Leave",
                "TimeAtPoint": "01:10:04"
            },
            .............
            .............
            .............
        ]
    }

Test

Test the PointActivity using your AccessToken by entering it below:

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