API: Refuel

M: Listar reabastecimientos

HTTP GET:
https://<hostname>/api/refuels
URL PARAMETERS:
Nombre Tipo Requerido Descripción
page_size Tamaño de Página Numérico no (opcional, default: 5000, max: 5000) Cantidad de elementos que se quiere obtener en la respuesta.
page_num Número de Página Numérico no (opcional, default: 0) Si la cantidad global de elementos es mayor al tamaño de página utilizado, se utiliza este parámetro para obtener una página específica.
OUTPUT:

Json con los campos:

EJEMPLO CON CURL:
$ curl -u <api_key>:<password>
     -X GET
     https://<hostname>/api/refuels?page_size=2
RESPUESTA:
{
    "success": false,
    "data": [
        {
            "id": "11291",
            "client_id": "22",
            "contract_id": "",
            "gas_station_id": "",
            "gas_station_name": "",
            "poi_id": "",
            "cost_center": "",
            "zone": "",
            "card_id": "",
            "receipt_id": "231564",
            "vehicle_id": "252",
            "driver_id": "",
            "odometer": "",
            "virtual_odometer": "6.7",
            "date_time": "2018-10-15 16:31:58.03+00",
            "fuel_type": "Otro",
            "fuel_volume": "10.00",
            "fuel_units": "",
            "price_per_unit": "20.00",
            "total": "200.00",
            "notes": "",
            "trip_id": "",
            "point_id": "",
            "creation_date": "2018-10-15 16:32:39+00"
        },
        {
            "id": "11290",
            "client_id": "22",
            "contract_id": "",
            "gas_station_id": "",
            "gas_station_name": "",
            "poi_id": "",
            "cost_center": "",
            "zone": "",
            "card_id": "",
            "receipt_id": "456798",
            "vehicle_id": "252",
            "driver_id": "",
            "odometer": "",
            "virtual_odometer": "6.7",
            "date_time": "2018-10-04 15:08:29.975+00",
            "fuel_type": "Premium",
            "fuel_volume": "13.00",
            "fuel_units": "",
            "price_per_unit": "30.00",
            "total": "390.00",
            "notes": "",
            "trip_id": "",
            "point_id": "",
            "creation_date": "2018-10-04 15:08:52+00"
        }
    ]
}

M: Insertar reabastecimiento

HTTP POST:
https://<hostname>/api/refuel
BODY PARAMETERS:

Json con los campos:

OUTPUT:

Json con los campos:

EJEMPLO CON CURL:
$ curl -u <api_key>:<password>
    --data '{"license_plate": "450sdf", "fuel_volume": "5", "price_per_unit": "25", "fuel_type": "Premium"}'
    https://<hostname>/api/refuel
RESPUESTA:
{
    "success": true,
    "notes": " odometro basado en viaje 159020"
}

M: Actualizar reabastecimiento

HTTP PUT:
https://<hostname>/api/refuel/<id>
BODY PARAMETERS:
OUTPUT:

Json con los campos:

EJEMPLO CON CURL:
$ curl -u <api_key>:<password>
     -X PUT
     --data "fuel_type=Premium"
     https://<hostname>/api/refuel/11291
RESPUESTA:
{
    "success": true,
    "data": {
        "id": "11291",
        "client_id": "22",
        "contract_id": "",
        "gas_station_id": "",
        "gas_station_name": "",
        "poi_id": "",
        "cost_center": "",
        "zone": "",
        "card_id": "",
        "receipt_id": "",
        "vehicle_id": "252",
        "driver_id": "",
        "odometer": "",
        "virtual_odometer": "6.7",
        "date_time": "2018-10-15 16:35:58.03+00",
        "fuel_type": "Premium",
        "fuel_volume": "10.00",
        "fuel_units": "",
        "price_per_unit": "100.00",
        "total": "1000.00",
        "notes": "",
        "trip_id": "",
        "point_id": "",
        "creation_date": "2018-10-15 16:36:39+00"
    }
}

O: Refuel Data Object

Cada objeto de reabastecimiento tiene estos campos:

campo read-only
id
client_id
contract_id no
gas_station_id no
gas_station_name no
poi_id no
cost_center no
zone no
card_id no
receipt_id no
vehicle_id
driver_id
odometer no
virtual_odometer
date_time no
fuel_type no
fuel_volume no
fuel_units no
price_per_unit no
total no
notes no
trip_id
point_id
creation_date

Ninguno de estos campos es requerido.