×

Fuel сonsumption

This API retrieves fuel consumption data for a specific vehicle over a selected period. It returns information about refuels, fuel used, fuel drains, and fuel sensor readings at the beginning and end of the period.

How to get data

Method

 GET

Request address

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

Request parameters

  • cmd=fuel — command to retrieve fuel data
  • ts — start date of the period (Unix timestamp)
  • te — end date of the period (Unix timestamp)
  • agentid — vehicle ID (agent_id)
    node — the number of the node where the command should be executed
 

Example request

https://<server_address>/backend/api.php?cmd=fuel&ts=1708981200&te=1709154000&agentid=6477&node=1
Response
{
  "code": 0,
  "data": {
    "fill": 100,    
    "fuel": 84,      
    "stale": 0,       
    "start": 27,      
    "stop": 43       
  },
  "msg": "OK"
}
In response to the API request, the following is returned:
  • code — result code of the request (0 = successful)
  • fill — amount of fuel refilled during the period
  • fuel — amount of fuel consumed
  • stale — amount of fuel drained or lost
  • start — fuel sensor reading at the start of the period
  • stop — fuel sensor reading at the end of the period
  • msg — textual message with the request result