×

Vehicle status and distance to point or geofence

This API provides the current status of a vehicle and the time and distance to a specified point or geofence.

How to get data

Method

 GET

Request address

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

Request parameters

  • cmd=get_status_and_distance — command to get the vehicle status and distance
  • vehnum — garage number or license plate of the vehicle; multiple values can be specified separated by commas
  • zone — geofence name (if you want to calculate distance to a geofence)
  • point — coordinates of a point in the format latitude,longitude (if you want distance to a specific point)
  • node — node number where the command should be executed
 

Example requests

https://<server_address>/api/api.php?cmd=get_status_and_distance&vehnum=M897ET777&zone=Hospital%20Lapino&node=1
https://<server_address>/api/api.php?cmd=get_status_and_distance&vehnum=M897ET777&point=55.923032,37.659668&node=1

Response

{
  "cstatus": 6,
  "cstatus_timestamp": 1554985159,
  "destination_name": "Zero coordinates",
  "distance": {
    "code": 0,
    "length": 27613,
    "msg": "OK",
    "point": "55.923032,37.659668",
    "time": 2002,
    "type": "point"
  },
  "ignition": 1,
  "rbu": "08",
  "sensors": {
    "Unloading Sensor": "on|1554985138",
    "Loading Sensor": "on|1554985138",
    "Ignition Sensor": "on|1554985138",
    "FUEL SENSORS OPERATION SENSORS": "Operating|1554985138",
    "Fuel ... fuel": "202.96 Liter|1554995669"
  },
  "source_name": "Loading_Chertanovo",
  "status": 4,
  "status_timestamp": 1554985072,
  "unixtimestamp": 1554995864,
  "vehiclenumber": "M897ET777",
  "zone": []
}
In response to the API request, the following is returned:
  • cstatus — current status of the vehicle
  • cstatus_timestamp — timestamp of the current status (Unix timestamp)
  • destination_name — name of the destination point
  • distance — object containing information about distance and time to a point or geofence:
  • length — distance in meters
  • time — time in seconds
  • type — type of object (point or zone)
  • point — coordinates of the point (if type=point)
  • ignition — ignition state (1 = on)
  • rbu — RBU identifier
  • sensors — status of various sensors (e.g., loading/unloading, fuel)
  • source_name — name of the data source
  • status — current status of the vehicle
  • status_timestamp — timestamp of the last status change
  • unixtimestamp — timestamp when the data was retrieved
  • vehiclenumber — vehicle license plate or garage number
  • zone — array of current geofences (if any)