GET /api/v1/team-members/{publicUserId}/reports/travel-statistics

This endpoint retrieves travel statistics reports for a specific team member within a specified date range (optional). The request should be made using an HTTP GET method to the following URL: https://api.locate2u.com/api/v1/team-members/{{publicUserId}}/reports/travel-statistics with the query parameters fromDate and toDate to specify the date range.

Input parameters:

publicUserId

Required* publicUserId (string) in the path which is the Public identifier for the team-member/user.

fromDate

Optional query parameter, Type : string ($date) with format “yyyy-MM-dd”
Specifies the start date of the date range for the travel statistics report.

toDate

Optional query parameter, Type : string ($date) with format “yyyy-MM-dd”
Specifies the end date of the date range for the travel statistics report.

Sample code

C#
Java
NodeJS
PHP
Python
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://api.locate2u.com/api/v1/team-members/{publicUserId}/reports/travel-statistics?fromDate=yyyy-MM-dd&toDate=yyyy-MM-dd");
request.Headers.Add("Authorization", "Bearer yourBearerTokenHere");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("https://api.locate2u.com/api/v1/team-members/{publicUserId}/reports/travel-statistics?fromDate=yyyy-MM-dd&toDate=yyyy-MM-dd")
  .method("GET", body)
  .addHeader("Authorization", "Bearer yourBearerTokenHere")
  .build();
Response response = client.newCall(request).execute();
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'api.locate2u.com',
  'path': '/api/v1/team-members/{publicUserId}/reports/travel-statistics?fromDate=yyyy-MM-dd&toDate=yyyy-MM-dd',
  'headers': {
    'Authorization': 'Bearer yourBearerTokenHere'
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();
 'https://api.locate2u.com/api/v1/team-members/{publicUserId}/reports/travel-statistics?fromDate=yyyy-MM-dd&toDate=yyyy-MM-dd',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer yourBearerTokenHere'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import requests

url = "https://api.locate2u.com/api/v1/team-members/{publicUserId}/reports/travel-statistics?fromDate=yyyy-MM-dd&toDate=yyyy-MM-dd"

payload = {}
headers = {
  'Authorization': 'Bearer yourBearerTokenHere'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Response

Response
The response for this request will be a JSON object representing the travel statistics report for the specified team member within the given date range. Below is a JSON schema representing the structure of the response:

{
  "type": "object",
  "properties": {
    "teamMemberId": {
      "type": "string"
    },
    "fromDate": {
      "type": "string",
      "format": "date"
    },
    "toDate": {
      "type": "string",
      "format": "date"
    },
    "travelDistance": {
      "type": "number"
    },
    "travelTime": {
      "type": "number"
    },
    "averageSpeed": {
      "type": "number"
    }
    // ... (other properties)
  }
}

Sample response : 

[
    {
        "date": "2024-06-06",
        "travelDistanceMeters": 2744,
        "travelTimeMinutes": 11.05,
        "estimatedTravelDistanceMeters": null,
        "estimatedTravelTimeMinutes": null,
        "tripId": null,
        "firstIgnitionOn": "2024-06-06T08:21:29.0000000+10:00",
        "lastIgnitionOff": "2024-06-06T08:41:19.0000000+10:00",
        "workingTimeMinutes": 19.833333333333332
    }
]