Skip to main content

List All Services

Retrieve a paginated list of service records.
GET /api/engrases

Query Parameters

page
number
default:"1"
Page number for pagination
limit
number
default:"20"
Number of records per page (max 100)
conductor
string
Filter by driver name (partial match, case-insensitive)
placa
string
Filter by vehicle plate (partial match, case-insensitive)
area_operacion
string
Filter by operational area (partial match, case-insensitive)
fecha_inicio
string
Start date filter (YYYY-MM-DD format)
fecha_fin
string
End date filter (YYYY-MM-DD format)
sort_by
string
default:"fecha"
Field to sort by: fecha, suma, placa, conductor
sort_order
string
Sort direction: asc or desc (default: desc for fecha)

Response

data
array
Array of service records
pagination
object
Pagination metadata

Example Request

curl -X GET "https://api.example.com/api/engrases?page=1&limit=10&fecha_inicio=2024-01-01&fecha_fin=2024-01-31" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Example Response

{
  "data": [
    {
      "idx": 1,
      "id": 101,
      "fecha": "2024-01-15",
      "conductor_id": 5,
      "conductor": "Juan Pérez",
      "placa_id": 23,
      "placa": "ABC-123",
      "area_operacion_id": 2,
      "area_operacion": "Zona Norte",
      "lavado": 25000,
      "engrase": 45000,
      "otros": 10000,
      "suma": 80000,
      "observaciones": "Servicio completo"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 10,
    "total": 45,
    "totalPages": 5
  }
}

Get Service by ID

Retrieve a specific service record.
GET /api/engrases/:id

Path Parameters

id
number
required
Service record ID

Example Request

curl -X GET "https://api.example.com/api/engrases/101" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Get Filter Options

Retrieve unique values for filter dropdowns.
GET /api/engrases/filter-options

Response

{
  "conductores": ["Juan Pérez", "María García"],
  "placas": ["ABC-123", "DEF-456"],
  "areas_operacion": ["Zona Norte", "Zona Sur"]
}

Financial Report

Generate a detailed financial report with totals.
GET /api/engrases/reportes/financiero
Supports the same filters as the list endpoint.
The financial report includes subtotals by area and service type.

Build docs developers (and LLMs) love