get_trips

To get information about trips for a specified period, upload unit messages and execute the unit/get_trips method.

Endpoint

Copied!
svc=unit/get_trips&params={
  "itemId": <long>,
  "msgsSource": <text>,
  "timeFrom": <uint>,
  "timeTo": <uint>
}

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.

Copied!
[
  {
    "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.

If you find a mistake in the text, please select it and press Ctrl+Enter.