Skip to content

[EN] API

Lito edited this page Apr 4, 2024 · 2 revisions

Authentication

For authentication you have to create an API KEY in your profile. This API KEY WILL ONLY BE DISPLAYED ONCE, so it is necessary to save it BEFORE updating the profile.

The use of this API KEY is through the Authorization: {API_KEY} header.

Some of the endpoints will not be accessible for your user, since it can be that your user does not have the permissions to consult them if you aren't an administrator or manager.

Endpoints

You can list all endpoints using php artisan help:show command:

[
    {
        "name": "api.device.index",
        "method": "GET|HEAD",
        "path": "api/device"
    },
    {
        "name": "api.device.create",
        "method": "POST",
        "path": "api/device/create"
    },
    {
        "name": "api.device.update",
        "method": "PATCH",
        "path": "api/device/{id}"
    },
    {
        "name": "api.device.delete",
        "method": "DELETE",
        "path": "api/device/{id}"
    },
    {
        "name": "api.help.index",
        "method": "GET|HEAD",
        "path": "api/help"
    },
    {
        "name": "api.help.detail",
        "method": "GET|HEAD",
        "path": "api/help/{name}"
    },
    {
        "name": "api.language.index",
        "method": "GET|HEAD",
        "path": "api/language"
    },
    {
        "name": "api.profile.index",
        "method": "GET|HEAD",
        "path": "api/profile"
    },
    {
        "name": "api.refuel.index",
        "method": "GET|HEAD",
        "path": "api/refuel"
    },
    {
        "name": "api.refuel.create",
        "method": "POST",
        "path": "api/refuel/create"
    },
    {
        "name": "api.refuel.update",
        "method": "PATCH",
        "path": "api/refuel/{id}"
    },
    {
        "name": "api.refuel.delete",
        "method": "DELETE",
        "path": "api/refuel/{id}"
    },
    {
        "name": "api.timezone.index",
        "method": "GET|HEAD",
        "path": "api/timezone"
    },
    {
        "name": "api.trip.index",
        "method": "GET|HEAD",
        "path": "api/trip"
    },
    {
        "name": "api.trip.position",
        "method": "GET|HEAD",
        "path": "api/trip/{id}/position"
    },
    {
        "name": "api.trip.update",
        "method": "PATCH",
        "path": "api/trip/{id}"
    },
    {
        "name": "api.trip.delete",
        "method": "DELETE",
        "path": "api/trip/{id}"
    },
    {
        "name": "api.user.index",
        "method": "GET|HEAD",
        "path": "api/user"
    },
    {
        "name": "api.user.create",
        "method": "POST",
        "path": "api/user/create"
    },
    {
        "name": "api.user.update",
        "method": "PATCH",
        "path": "api/user/{id}"
    },
    {
        "name": "api.user.delete",
        "method": "DELETE",
        "path": "api/user/{id}"
    },
    {
        "name": "api.vehicle.index",
        "method": "GET|HEAD",
        "path": "api/vehicle"
    },
    {
        "name": "api.vehicle.create",
        "method": "POST",
        "path": "api/vehicle/create"
    },
    {
        "name": "api.vehicle.update",
        "method": "PATCH",
        "path": "api/vehicle/{id}"
    },
    {
        "name": "api.vehicle.delete",
        "method": "DELETE",
        "path": "api/vehicle/{id}"
    }
]

For every endpoint, you can get help with same command adding the name as parameter, for example php artisan help:show api.vehicle.create:

{
    "name": "api.vehicle.create",
    "method": "POST",
    "path": "api/vehicle/create",
    "validation": {
        "name": [
            "bail",
            "required"
        ],
        "plate": [
            "bail"
        ],
        "timezone_auto": [
            "bail",
            "boolean"
        ],
        "enabled": [
            "bail",
            "boolean"
        ],
        "timezone_id": [
            "bail",
            "required",
            "integer"
        ],
        "user_id": [
            "bail",
            "integer"
        ]
    }
}