get_trips
To get information about trips for a specified period, upload unit messages and execute the unit/get_trips command.
svc=unit/get_trips¶ms={"itemId":<long>,
"msgsSource":<text>,
"timeFrom":<uint>,
"timeTo":<uint>}
This request can’t be executed simultaneously with the following requests:
- …/report/exec_report,
- …/report/export_result,
- …/report/get_result_chart,
- …/report/get_result_map,
- …/render/create_messages_layer,
- …/messages/load_interval,
- …/resource/get_driver_bindings,
- …/resource/get_trailer_bindings,
- all requests from the section exchange,
- …/account/get_account_history.
Parameters
| Name | 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
| 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. |