×

Add fuel card transaction

This API adds a fuel transaction record for a fuel card, including information about the amount of fuel, cost, location, and driver.

How to get data

Method

POST

Request address

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

Request parameters

Required:
  • cmd=add_fuel_transaction — API command to add a transaction
  • card_num — fuel card number
  • operation — type of operation (e.g., refill)
  • unixtimestamp — transaction time in Unix timestamp format
  • place — location of the operation
  • azs — name of the fuel station
  • liters — amount of fuel in liters
  • fuel — fuel type
  • price — price per liter without discount
  • sum — total amount without discount
  • node — node number where the command should be executed
Optional:
  • priceg — price per liter with discount
  • sumg — total amount with discount
  • driver — driver’s full name
  • lat — latitude of the transaction location
  • lon — longitude of the transaction location
  • info — additional information
  • internal_id — internal transaction identifier
 

Example request

https://<server_address>/api/api.php?cmd=add_fuel_transaction&node=1
Example request body (JSON):
{
  "card_num": "1234567890123456",
  "operation": "refill",
  "unixtimestamp": 1695000000,
  "place": "Main street 12",
  "azs": "WOG",
  "liters": 50,
  "fuel": "Diesel",
  "price": 55.0,
  "sum": 2750.0,
  "driver": "Ivan Ivanov"
}
Response
{
  "code": 0,
  "msg": "OK"
}
In response to the API request, the following is returned:
  • code — result code (0 = success)
  • msg — server message about the operation result