Skip to content

[ES] API

Lito edited this page Apr 4, 2024 · 1 revision

Autenticación

Para la autenticación debes crear una Clave API desde tu perfil o en la edición de usuario si eres administrador. Esta Clave API SÓLO SE MOSTRARÁ UNA VEZ, por lo que es necesario guardarla ANTES de actualizar el perfil.

El uso de esta Clave API se realiza a través de la cabecera Authorization: {API_KEY}.

Algunos de los endpoints no serán accesibles para tu perfil, ya que puede ser que tu usuario no tenga permisos para consultarlos si no es administrador o gestor.

Endpoints

Puede listar todos los endpoints usando el comando php artisan help:show.

Actualmente son los siguientes:

[
    {
        "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}"
    }
]

Para cada endpoint, puedes obtener ayuda con ese mismo comando añadiendo el nombre de ruta name como parámetro, por ejemplo 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"
        ]
    }
}