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 visits for a device between two timestamps

Note

  1. If the from_timestamp / to_timestamp lies between a visit, that visit 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/visits/

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

Sample Request

curl
--request GET
--url https://api.hypertrack.com/v3/visits/
--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

visits

JSON

An array of visits

Each visit segment will have following properties:

Property

Type

Comment

id

UUID string

Unique id of this visit

expected_visit_id

UUID string

Id of the expected_visit that created this visit

expected_visit_metadata

JSON

Metadata of the expected_visit that created this visit

place

JSON

Place where the visit happened; included name and location of the place

start_time

ISO datetime string

Start time of the visit (when the device entered the geofence)

end_time

ISO datetime string

End time of the visit (when the device exited the geofence)

distance

Integer

Distance covered within this visit

steps

Integer

Steps covered within this visit

polyline

String

Latitude and longitude encoded into a compressed string

location_time_series

String

Latitude, longitude and timestamp encoded into a compressed string

Sample Response

{
"device_id": "5d728988-9c23-4bd7-bfc3-048918199d53",
"from_timestamp": "2018-10-20T08:00Z",
"to_timestamp": "2018-10-20T09:00Z",
"visits":{
{
"id":"6b051a62-2ff8-4620-b4f6-27ce031c5915",
"expected_visit_id":"6bx37475-45d5-d5fe-d76d-27ce031c4634",
"expected_visit_metadata":{
...
},
"place":{
"type": "point",
"coordinates": [
-122.3985203814826,
37.7869638230917
]
},
"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?_"
},
...
}
}

‚Äč