get_trips
To get information about trips for a specified period, upload unit messages and execute the unit/get_trips method.
Endpoint
svc=unit/get_trips¶ms={
"itemId": <long>,
"msgsSource": <text>,
"timeFrom": <uint>,
"timeTo": <uint>
}
The method is a resource-intensive request, so the limit on simultaneous resource-intensive requests during one session applies to it. If the limit is reached, the error 1003 with the
LIMIT api_concurrentreason is returned. For the list of resource-intensive requests, see Limitations.
Parameters
| Parameter | Description |
|---|---|
itemId |
Unit ID. |
timeFrom |
Interval beginning. |
timeTo |
Interval end. |
msgsSource |
Message layer name (only one layer is available). Specify 1 to use the message loader. |
Response
If the request is completed successfully, the response contains information about trips.
[
{
"from": { /* Starting point of the trip */
"i": <uint>, /* Message index */
"t": <uint>, /* Time */
"p": { /* Location */
"y": <double>, /* Latitude */
"x": <double> /* Longitude */
}
},
"to": { /* Ending point of the trip */
"i": <uint>, /* Message index */
"t": <uint>, /* Time */
"p": { /* Location */
"y": <double>, /* Latitude */
"x": <double> /* Longitude */
}
},
"m": <double> /* Mileage (meters) */
}
]
If the request fails, an error code is returned.
Error codes
| Error code | Description |
|---|---|
| 4 | Invalid item ID or input format. |
| 6 | Failed to fetch unit messages. |
| 7 | The user doesn’t have the Request reports and messages access right to the unit. |