Getters and statistics

Introduction

This section contains the Rest API functions for retrieval data of your organization such as list of users, user trips and user statistics.
For doing so you need to have an access token available, which you can retrieve through initialization function.

General access scheme

In the function description below set the URL address prefix UAP as https://driversbehaviour-dataapigateway.azurewebsites.net
The communication services needs to be accessed with the setting:

Content-Type: application/json

The token retrieved needs to be input into any of the data access functions through the Authorization header with the name Bearer in the form:

Authorization: Bearer <access_token>

The API responses are in a self-explanatory json format.

Get users

A paged list of users of your organization matching the filter is returned.
Each user is denoted with an external id to be used with the subsequent “users” and “trips” methods.
The paging mechanism is restricted to 1000 items.

For more info see Users: get-users in Swagger doc

Example

POST UAP/api/v1/users/get-users
{
  "filter": {
    "createdDateFromInclusive": "2020-03-20T00:00:00.000Z",
    "createdDateToExclusive": "2020-04-20T00:00:00.000Z",
    "orderBy": "createdDate",
    "page": 1,
    "pageSize": 100,
    "isDescending": true
  }
}

Get trips

Given the user id (from the method “get-users”) and datetime period in the standard UTC format a paged list of trips is returned.
The trips are enumerated with external ids, which should be used with the method “get-trip-detail”.
The individual trips are returned with additional details.
The paging mechanism is restricted to 50 items.

For more info see Trips: get-trips in Swagger doc

Example

POST UAP/api/v1/trips/get-trips
{
  "filter": {
    "externalUserId": "3fa85f64-5717",
    "tripStartDateFromInclusive": "2020-03-01T00:00:00.000Z",
    "tripStartDateToExclusive": "2020-04-01T00:00:00.000Z",
    "userAsDriver": true,
    "tripEvaluationResult": null,
    "includeDetails": false,
    "orderBy": "tripStartDate",
    "page": 1,
    "pageSize": 10,
    "isDescending": true
  }
}

Get trip detail

Given the trip identification (from the method “get-trips”) a trip detail is returned,
containing the full trip GPS trajectory, placement, detail of driving events and trip scores, and vehicle settings.

For more info see Trips: get-trip-detail in Swagger doc

Example

POST UAP/api/v1/trips/get-trip-detail
{
  "externalId": "3fa85f64-5717"
}

Get monthly statistics

Retrieves full driving score statistics of a user given his id from the “get-users” method, for a particular month range, where the month is in the form YYYY/MM.

For more info see User: monthly-stats in Swagger doc

Example

POST UAP/api/v1/users/monthly-stats
{
   "filter": {
   "externalUserId": "3fa85f64-5717",
   "startMonth": "2019/07",
   "endMonth": "2019/09"
   }
}