Get Maintenance Plans
curl -X GET "https://api.example.com/api/mantenimiento/planes?vehiculo_id=123&activo=true" \
-H "Authorization: Bearer YOUR_TOKEN"
Endpoint
GET /api/mantenimiento/planes
Query Parameters
Filter plans by vehicle ID
Filter by active status (true/false)
Response
Returns an array of maintenance plans with their conditions and related data.
Unique identifier for the maintenance plan
ID of the vehicle this plan applies to
ID of the maintenance type
Name/description of the maintenance plan
Whether the plan is currently active
Related maintenance type information
Type name (e.g., “Preventivo”, “Correctivo”)
Array of conditions that trigger this maintenance
Type of condition (time, km, hours)
Threshold value for the condition
Unit of measurement (e.g., “km”, “dias”, “horas”)
Example Response
[
{
"id": 1,
"vehiculo_id": 123,
"tipo_mantenimiento_id": 1,
"nombre": "Mantenimiento Preventivo 10K",
"activo": true,
"tipo_mantenimiento": {
"tipo": "Preventivo"
},
"plan_condicion": [
{
"id": 1,
"plan_id": 1,
"tipo_condicion_id": 1,
"valor": 10000,
"unidad": "km",
"tipo_condicion": {
"nombre": "Kilómetros",
"codigo": "KM"
}
},
{
"id": 2,
"plan_id": 1,
"tipo_condicion_id": 2,
"valor": 180,
"unidad": "dias",
"tipo_condicion": {
"nombre": "Días",
"codigo": "DIAS"
}
}
]
}
]
Create Maintenance Plan
curl -X POST https://api.example.com/api/mantenimiento/planes \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"vehiculo_id": 123,
"tipo_mantenimiento_id": 1,
"nombre": "Mantenimiento Preventivo 10K",
"activo": true,
"condiciones": [
{
"tipo_condicion_id": 1,
"valor": 10000,
"unidad": "km"
},
{
"tipo_condicion_id": 2,
"valor": 180,
"unidad": "dias"
}
]
}'
Endpoint
POST /api/mantenimiento/planes
Request Body
ID of the vehicle this plan applies to
ID of the maintenance type
Name/description of the maintenance plan
Whether the plan is active
Array of conditions for this maintenance plan
Type of condition (get available types from /condiciones endpoint)
Threshold value for the condition
Unit of measurement (e.g., “km”, “dias”, “horas”)
Response
Returns the created maintenance plan object.
Unique identifier for the created plan
Example Response
{
"id": 45,
"vehiculo_id": 123,
"tipo_mantenimiento_id": 1,
"nombre": "Mantenimiento Preventivo 10K",
"activo": true
}
Update Maintenance Plan
curl -X PUT https://api.example.com/api/mantenimiento/planes/45 \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"nombre": "Mantenimiento Preventivo 15K",
"activo": true,
"condiciones": [
{
"tipo_condicion_id": 1,
"valor": 15000,
"unidad": "km"
}
]
}'
Endpoint
PUT /api/mantenimiento/planes/:id
URL Parameters
ID of the maintenance plan to update
Request Body
All fields from the create endpoint are supported. Only include fields you want to update.
Update the maintenance type
Replace all conditions with new ones. Existing conditions will be deleted and replaced.
Response
Returns the updated maintenance plan object.
Example Response
{
"id": 45,
"vehiculo_id": 123,
"tipo_mantenimiento_id": 1,
"nombre": "Mantenimiento Preventivo 15K",
"activo": true
}
Get Maintenance Types
curl -X GET https://api.example.com/api/mantenimiento/tipos \
-H "Authorization: Bearer YOUR_TOKEN"
Endpoint
GET /api/mantenimiento/tipos
Response
Returns an array of available maintenance types.
Unique identifier for the maintenance type
Type name (e.g., “Preventivo”, “Correctivo”, “Predictivo”)
Description of the maintenance type
Example Response
[
{
"id": 1,
"tipo": "Preventivo",
"descripcion": "Mantenimiento programado regular"
},
{
"id": 2,
"tipo": "Correctivo",
"descripcion": "Reparaciones por fallas"
},
{
"id": 3,
"tipo": "Predictivo",
"descripcion": "Basado en monitoreo de condiciones"
}
]
Create Maintenance Type
curl -X POST https://api.example.com/api/mantenimiento/tipos \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"tipo": "Emergencia",
"descripcion": "Mantenimiento de emergencia no programado"
}'
Endpoint
POST /api/mantenimiento/tipos
Request Body
Name of the maintenance type
Description of the maintenance type
Response
Returns the created maintenance type.
Example Response
{
"id": 4,
"tipo": "Emergencia",
"descripcion": "Mantenimiento de emergencia no programado"
}
Get Condition Types
curl -X GET https://api.example.com/api/mantenimiento/condiciones \
-H "Authorization: Bearer YOUR_TOKEN"
Endpoint
GET /api/mantenimiento/condiciones
Response
Returns an array of condition types that can be used in maintenance plans.
Unique identifier for the condition type
Condition type code (e.g., “KM”, “DIAS”, “HORAS”)
Human-readable name of the condition type
Example Response
[
{
"id": 1,
"codigo": "KM",
"nombre": "Kilómetros"
},
{
"id": 2,
"codigo": "DIAS",
"nombre": "Días"
},
{
"id": 3,
"codigo": "HORAS",
"nombre": "Horas de Motor"
}
]