Approved track management

This API helps work with approved vehicle tracks: set periods, retrieve tracks, and use the track player.

How to get data

Request address

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

Request parameters

Parameters are passed through the query string using either POST or GET, depending on the command.
To get the required data, add parameters to the request URL. Parameters are added after the question mark ? and separated by &.
  • cmd=set_approved_tracks — command to set approved periods
  • cmd=get_approved_tracks — command to get approved tracks
  • node — the number of the node where the command should be executed
  • veh — vehicle registration number or identifier
  • ts — start of the period (timestamp)
  • te — end of the period (timestamp)
     

Set approved periods

Example API request:
https://<server_address>/api/api.php?cmd=set_approved_tracks&veh=Р852ОВ77&ts=1537945200&te=1537952400&node=1
API response:
{"code":0,"msg":"OK updated"}
 

Get approved tracks

Example API request:
http://<server_address>/api/api.php?cmd=get_approved_tracks&veh=Р852ОВ77&ts=1537945200&te=153795 2400
API response:
{
  "code":0,
  "data":{
    "approved":[
      {"length":2.8051348330013,"ts":1537948809,"te":1537949431,"max_speed":"59","avg_speed":26}
    ],
    "not_approved":[
      {"length":1.8650025635569,"ts":1537945206,"te":1537946030,"max_speed":"40","avg_speed":12},
      {"length":4.1987356239849,"ts":1537948298,"te":1537948798,"max_speed":"65","avg_speed":37}
    ]
  }
}
In the API response:
  • approved — list of approved tracks
  • not_approved — list of tracks that were not approved
  • length — track length in kilometers
  • ts — track start time (timestamp)
  • te — track end time (timestamp)
  • max_speed — maximum speed on the track
  • avg_speed — average speed
 

Track player

The track player is a web service that allows visual viewing of vehicle tracks. Unlike the regular API, it immediately returns a ready-made page with the map and track, not JSON or XML.
Link to view the track:
http://<server_address>/api/track_player.php?login=demo&pass=demo&ts=1536933600&te=1536940800&veh=в848ае199&lang=ru
You can use this URL as the iframe src to display the track on a webpage.