API

Last updated 11 days ago

This product feature is still under development and is not available in production. Please reach out to us on Slack if you want an early access.

API to fetch trips for a device between two timestamps

Note

  1. If the from_timestamp / to_timestamp lies between a trip, that trip is included in the output

  2. Maximum allowed time range is of one day; queries that exceed that will given an error

  3. Historical data beyond 7 days is not available

HTTP Request

GET https://api.hypertrack.com/v3/trips/

Parameters

Parameter

Type

Description

Required

device_id

UUID string

ID of the device

Required

from_timestamp

ISO datetime string

Time from which you want the data

Required

to_timestamp

ISO datetime string

Time to which you want the data

Optional; defaults to current time

trips

Boolean

Set it to true if you want trips, false otherwise

Optional; defaults to FALSE

Sample Request

curl
--request GET
--url https://api.hypertrack.com/v3/trips/
--header 'Authorization: token SECRET_KEY'
--header 'Content-Type: application/json'
--data '{
"device_id": "5d728988-9c23-4bd7-bfc3-048918199d53",
"from_timestamp": "2018-10-20T08:00Z",
"to_timestamp": "2018-10-20T09:00Z"
}

Returns

Property

Type

Comment

device_id

UUID string

Device ID sent in the request

from_timestamp

ISO datetime string

From timestamp sent in the request

to_timestamp

ISO datetime string

To timestamp sent in the request

trips

JSON

An array of trips

Each trip object will have following properties:

Property

Type

Comment

id

UUID string

start_place

JSON

end_place

JSON

start_time

ISO datetime string

end_time

ISO datetime string

distance

Integer

steps

Integer

polyline

String

location_time_series

String

Sample Response

{
"device_id": "5d728988-9c23-4bd7-bfc3-048918199d53",
"from_timestamp": "2018-10-20T08:00Z",
"to_timestamp": "2018-10-20T09:00Z",
"trips":{
{
"id":"6b051a62-2ff8-4620-b4f6-27ce031c5915",
"expected_visit_id":"6bx37475-45d5-d5fe-d76d-27ce031c4634",
"expected_visit_metadata":{
...
},
"start_place":{
"type": "point",
"coordinates": [
-122.3985203814826,
37.7869638230917
]
},
"end_place":{
"type": "point",
"coordinates": [
-121.2937327336,
36.6437640917
]
},
"start_time":"2018-10-20T08:00:00.000000+00:00",
"end_time":"2018-10-20T08:05:22.757000+00:00",
"distance":123.94139207233032,
"steps":0,
"polyline":"yvucN}|blDR?`AJ?HH??HaABy@?E?",
"location_time_series":"yvucN}|blD_ezks{vuwGR?_cidP`AJ_qo]?H_kv|PH?_"
},
...
}
}