×

Mileage inside geofences

This API gets information about the mileage of vehicles within specified geofences for a selected period of time.

How to get data

Method

 GET

Request address

To get the data, use the address: https://<server_address>/api/api.php?

Request parameters

  • cmd=zones_mileage — command for getting mileage in geofences
  • ts — start time of the period (Unix timestamp)
  • te — end time of the period (Unix timestamp)
  • imei — list of device IMEIs, separated by commas
  • zones — list of geofence names, separated by commas (optional; if not specified, mileage for all zones is returned)
  • node — node number where the command should be executed
     

Example request

https://<server_address>/api/api.php?cmd=zones_mileage&
ts=1596229200&te=1597006800&imei=867857035056105,123123123&zones=Simferopol,Belogorsk,Sudak&node=1
Response
{
  "code":0,
  "ts":"1596229200",
  "te":"1597006800",
  "data":{
     "867857035056105":[
        {
           "zone":"Simferopol",
           "duration":88308,
           "mileage":259.84
        },
        {
           "zone":"Outside city",
           "duration":21564,
           "mileage":283.47
        },
        {
           "zone":"Belogorsk",
           "duration":704,
           "mileage":10.77
        },
        {
           "zone":"Sudak",
           "duration":1332,
           "mileage":11.45
        }
     ]
  }
}
In response to the API request, the following is returned:
  • zone — geofence name
  • duration — time spent in the zone in seconds
  • mileage — distance traveled in the zone in kilometers