Fuel card transactionss
Use this API to retrieve data about vehicle refueling over a selected period. With it, you can:
— view fuel card transactions (fuel purchases, card balance, fuel type, gas station)
— get data on fuel refills and drains from the vehicle’s sensor (coordinates, fuel amount, event location)
— monitor fuel levels at the start and end of each day for every vehicle
How to get data
Method
GET
Request address
To get the data, use the address: https://<server_address>/api/api.php?
Request parameters
-
cmd=fuel — command to get fuel data
-
imei — vehicle identifier in the system
-
start — start time of the period (Unix timestamp)
-
stop — end time of the period (Unix timestamp)
-
node — node number where the command is executed
-
node — node number on which to execute the command
Example request
https://<server_address>/api/api.php?cmd=fuel&imei=863591021267806&start=1404158400&stop=1406836800&node=1
|
The JSON response contains three main sections:
1. Fuel Cards (cards)
Array of cards with information about each card and its transactions:
"cards": [
{
"id": 601,
"card_num": "257464691",
"balance": "0",
"type_name": "Magistral",
"transactions": {
"1404206488": {
"operation": "Purchase",
"ts": 1404206488,
"azs": "Gas Station Name",
"liters": "20.0000",
"sum": "636.00",
"sumg": "658.26",
"fuel": "Diesel",
"price": "31.80",
"priceg": "32.91",
"saldo": "0.00"
}
}
}
]
|
-
id — card ID in PILOT system
-
card_num — card number
-
balance — card balance at the time of the query
-
type_name — card type
-
transactions — fuel card transactions:
-
operation — type of operation (Purchase/Return, etc.)
-
ts — transaction timestamp
-
azs — gas station name
-
liters — fuel volume
-
sum — discounted amount
-
sumg — full amount
-
fuel — fuel type
-
price — discounted price per liter
-
priceg — full price per liter
-
saldo — card balance at the transaction2. Sensor Fillings/Drains (fillings)Object where keys are event timestamps and values contain data about fuel refills or drains:
"fillings": {
"1404205495": {
"ts": 1404205495,
"type_id": 1, // 1 = refill, 2 = drain
"liters": "23.2862",
"lat": "51.9899",
"lon": "47.8203",
"place": "RU, Saratov Region, Balakovo",
"fuel_start": "223.68" // fuel level at start of event
}
}
|
-
ts — event time (Unix timestamp)
-
type_id — event type (1 = refill, 2 = drain)
-
liters — fuel amount
-
lat/ lon — coordinates
-
place — location description
-
fuel_start — fuel level at the start of the event3. Daily Fuel Balances (fuel)Object where keys are day start timestamps and values contain fuel balances:
"fuel": {
"1404072000": {
"ts": 1404072000, // day start timestamp
"te": 1404158400, // day end timestamp
"start": "4.76", // fuel at start of day (liters)
"stop": "18.93" // fuel at end of day (liters)
}
}
|
-
ts — day start timestamp
-
te — day end timestamp
-
start — fuel at the start of the day
-
stop — fuel at the end of the day