driverTrips

The driverTrips API is an IQL Server API, which allows customers to fetch driver trips, and trip information such as trip start location, trip end location, trip distance, trip highway distance, score, and event ratings. The driverTrips endpoint is consistent with the existing driverStatus endpoint and allows publishers to enhance the IQL experience for their user base.

GET iql.zendrive.com/iql/v1/driver/:driver_id/trips

Query Parameters

Name
Type
Description

limit

Integer

Maximum number of trips to be returned in response. Default value: 50

cursor

String

This parameter is not provided for the first query. It will be returned in the response body as next_cursor in all future responses for a user. If the response field is set to empty, no more trips will be available to the user.

order_type

string (asc or desc)

Field values asc and desc return trips sorted by start timestamp in ascending order and descending order, respectively.

Default value: desc

length_unit

string (mile or km)

The unit of the all length metrics are returned in response, that is, highway_distance, distance) Default value: mile

{
    // Response
}

Limitations

If the cursor field is populated, the order_type field must remain consistent for all the requests.

Response Body Fields

Field Name
Nullable
Type
Description

trips[].trip_id

No

string

Unique identifier for a driver’s trip. Epoch start timestamp will be used.

trips[].start_time

No

string

Time (including time zone) of trip start.

trips[].start_location.longitude

No

float

The exact longitude of the trip start location.

trips[].start_location.latitude

No

float

The exact latitude of the trip start location.

trips[].highway_distance

No

float

The highway driving distance in units specified by the length_unit field.

trips[].end_time

No

string

The time (including time zone) of trip start

trips[].end_location.longitude

No

float

The exact longitude of the trip end location.

trips[].end_location.latitude

No

float

The exact latitude of the trip end location.

trips[].driving_behavior.score

No

object

The driving score assigned to the trip.

trips[].driving_behavior.event_rating

No

object

Event ratings for trip.

trips[].distance

No

float

The trip distance in units specified by thelength_unit field.

response_metadata.total_trips

No

integer

The total trips taken by the driver.

response_metadata.next_cursor

No

string

The field value is to be used to fetch the next batch of trips. It will be set to the next greater or lesser epoch timestamp in case more trips need to be fetched. The next_cursor value will be returned in the response body.

response_metadata.limit

No

integer

Maximum size of current batch.

driver_id

No

string

Unique identifier of driver.

Response Example

{
  "trips": [
    {
      "trip_id": "1659875419958",
      "start_time": "2022-08-07T18:00:19+05:30",
      "end_time": "2022-08-07T18:07:14+05:30",
      "start_location": {
        "latitude": 38.9672343,
        "longitude": -92.3494834
      },
      "end_location": {
        "latitude": 39.1765687,
        "longitude": -91.8725618
      },
      "distance": 2.388,
      "highway_distance": 0.0,
       "length_unit": "km/mile",
      "driving_behavior": {
        "score":{'zendrive_score': 93},
        "event_rating": {
          "rapid_acceleration": 5,
          "hard_turn": 5,
          "hard_brake": 5,
          "phone_use": 5,
          "over_speeding": 5
        }
      }
    }
  ],
  "driver_id": "[email protected]",
  "response_metadata": {
    "next_cursor": "",
    "limit": 50
    "total_trips": 1
  }
}