Trip statistics and distance
This API provides information about mileage, trips, and parkings of a vehicle for a specified time period.
How to get data
Method
GET
Request address
To get the data, use the address: https://<server_address>/api/api.php?
Request parameters
-
cmd=distance — API command to get mileage data
-
imei — unique identifier of the vehicle/device
-
start — start time of data collection (Unix timestamp)
-
stop — end time of data collection (Unix timestamp)
-
node — node number where the command should be executed
Example request
https://<server_address>/api/api.php?cmd=distance&imei=7157153151020&start=1676926800&stop=1677013200&node=1
|
Response
{
"code": 0,
"msg": "OK",
"distance": {
"duration": 23740,
"length": 104.54,
"start": 1761944400,
"stop": 1762030800,
"can": 0,
"usecan": false,
"gps": 104.54,
"parking_time": 62237,
"parking_count": 14,
"max_speed": 92,
"avg_speed": 18,
"trips_cnt": 6,
"trips_ts": 1761947653,
"trips_te": 1762027933,
"trips_time": 80280,
"trips_driving": 18043,
"parkings": {
"1761948742": {
"ts": 1761948742,
"te": 1761949164,
"lat": "25.404495",
"lon": "55.443546",
"track_id": 341967622
},
"1761950225": {
"ts": 1761950225,
"te": 1761978656,
"lat": "25.380997",
"lon": "55.434662"
},
"1761978976": {
"ts": 1761978976,
"te": 1761979445,
"lat": "25.386534",
"lon": "55.439198",
"track_id": 342008717
},
"1761983958": {
"ts": 1761983958,
"te": 1761984933,
"lat": "25.386375",
"lon": "55.413776",
"track_id": 342008717
},
"1761986309": {
"ts": 1761986309,
"te": 1761988132,
"lat": "25.341892",
"lon": "55.397186",
"track_id": 342008717
},
"1761988857": {
"ts": 1761988857,
"te": 1761989297,
"lat": "25.368885",
"lon": "55.42438",
"track_id": 342008717
},
"1761989685": {
"ts": 1761989685,
"te": 1762002192,
"lat": "25.380968",
"lon": "55.434662"
},
"1762002484": {
"ts": 1762002484,
"te": 1762002826,
"lat": "25.378464",
"lon": "55.442036",
"track_id": 342062148
},
"1762003344": {
"ts": 1762003344,
"te": 1762003645,
"lat": "25.381042",
"lon": "55.434467",
"track_id": 342062148
},
"1762005988": {
"ts": 1762005988,
"te": 1762006366,
"lat": "25.316278",
"lon": "55.382927",
"track_id": 342062148
},
"1762007656": {
"ts": 1762007656,
"te": 1762008203,
"lat": "25.354523",
"lon": "55.382133",
"track_id": 342062148
},
"1762010014": {
"ts": 1762010014,
"te": 1762012025,
"lat": "25.381067",
"lon": "55.434717"
},
"1762012439": {
"ts": 1762012439,
"te": 1762021038,
"lat": "25.369600",
"lon": "55.435860"
},
"1762022306": {
"ts": 1762022306,
"te": 1762027298,
"lat": "25.380917",
"lon": "55.434715"
}
},
"tracks": {
"341967622": {
"start": 1761947653,
"stop": 1761950225,
"ts": 1761947653,
"te": 1761950225,
"length": 22.83,
"can": null,
"gps": 22.83,
"max_speed": 92,
"avg_speed": 26,
"parkings": [1761948742],
"parking_count": 1,
"parking_time": 422,
"startlat": "25.381645",
"stoplat": "25.380997",
"startlon": "55.528587",
"stoplon": "55.434662"
},
"342008717": {
"start": 1761978656,
"stop": 1761989685,
"ts": 1761978656,
"te": 1761989685,
"length": 43.99,
"can": null,
"gps": 43.99,
"max_speed": 72,
"avg_speed": 18,
"parkings": [1761978976, 1761983958, 1761986309, 1761988857],
"parking_count": 4,
"parking_time": 3707,
"startlat": "25.380960",
"stoplat": "25.380968",
"startlon": "55.434743",
"stoplon": "55.434662"
},
"342062148": {
"start": 1762002192,
"stop": 1762010014,
"ts": 1762002192,
"te": 1762010014,
"length": 28.78,
"can": null,
"gps": 28.78,
"max_speed": 61,
"avg_speed": 14,
"parkings": [1762002484, 1762003344, 1762005988, 1762007656],
"parking_count": 4,
"parking_time": 1568,
"startlat": "25.381003",
"stoplat": "25.381067",
"startlon": "55.434752",
"stoplon": "55.434717"
},
"342078382": {
"start": 1762012025,
"stop": 1762012439,
"ts": 1762012025,
"te": 1762012439,
"length": 2.32,
"can": null,
"gps": 2.32,
"max_speed": 34,
"avg_speed": 19,
"parkings": [],
"parking_count": 0,
"parking_time": 0,
"startlat": "25.381067",
"stoplat": "25.369600",
"startlon": "55.434717",
"stoplon": "55.435860"
},
"342089059": {
"start": 1762021038,
"stop": 1762022306,
"ts": 1762021038,
"te": 1762022306,
"length": 3.97,
"can": null,
"gps": 3.97,
"max_speed": 49,
"avg_speed": 11,
"parkings": [],
"parking_count": 0,
"parking_time": 0,
"startlat": "25.369557",
"stoplat": "25.380917",
"startlon": "55.435802",
"stoplon": "55.434715"
},
"342095630": {
"start": 1762027298,
"stop": 1762027933,
"ts": 1762027298,
"te": 1762027933,
"length": 2.65,
"can": null,
"gps": 2.65,
"max_speed": 32,
"avg_speed": 13,
"parkings": [],
"parking_count": 0,
"parking_time": 0,
"startlat": "25.380903",
"stoplat": "25.380952",
"startlon": "55.434485",
"stoplon": "55.434668"
}
},
"startlat": "25.381645",
"startlon": "55.528587",
"stoplat": "25.380952",
"stoplon": "55.434668",
"active_days": 1,
"range_dates": {
"1761944400": 1
}
}
}
|
In response to the API request, the following is returned:
-
duration — total trip duration in seconds
-
length — actual distance traveled in kilometers
-
max_speed — maximum speed in km/h
-
avg_speed — average speed in km/h
-
trips_cnt — number of trips
-
trips_time — total trip time in seconds
-
trips_driving — time spent driving without stops in seconds
-
parking_count — number of parking events
-
parking_time — total parking time in seconds
-
parkings — an array of parking events, each parking event includes:
-
ts — parking start time
-
te — parking end time
-
lat — latitude
-
lon — longitude
-
length — parking duration in kilometers
-
track_id — track identifier associated with the parking event. If the parking is linked to a track, this field will contain a unique track ID.
-
tracks — an array of trip data, each trip includes:
-
length — trip distance
-
max_speed — maximum speed
-
avg_speed — average speed
-
startlat, startlon, stoplat, stoplon — coordinates of the start and end points of the trip