Introduction
The Maintenance API provides comprehensive endpoints for managing vehicle maintenance operations including:- Maintenance Plans: Define scheduled maintenance plans with conditions based on time, kilometers, or hours
- Maintenance Events: Record actual maintenance activities performed on vehicles
- Schedule Management: Track upcoming maintenance based on plan conditions
- Workshop Management: Manage workshop/taller information for maintenance services
Authentication
All maintenance endpoints require authentication using a Bearer token:authMiddleware which validates the JWT token and attaches user information to the request.
Base URL
Core Concepts
Maintenance Plans (PlanMantenimiento)
Maintenance plans define scheduled maintenance requirements for vehicles. Each plan:- Is associated with a specific vehicle
- Has a maintenance type (preventive, corrective, etc.)
- Contains one or more conditions that trigger the maintenance
- Can be activated or deactivated
Plan Conditions (PlanCondicion)
Conditions define when maintenance should be performed:- Time-based: Based on calendar dates (e.g., every 6 months)
- Kilometer-based: Based on distance traveled (e.g., every 5000 km)
- Hour-based: Based on engine hours (e.g., every 250 hours)
Maintenance Events (MantenimientoEvento)
Events record actual maintenance activities:- Linked to a maintenance plan (optional)
- Include date, cost, and workshop information
- Record current kilometer and hour readings
- Support detailed descriptions and observations
Available Endpoints
Maintenance Plans
GET /planes- List maintenance plansPOST /planes- Create a new maintenance planPUT /planes/:id- Update a maintenance plan
Maintenance Events
GET /eventos- List maintenance eventsPOST /eventos- Create a new maintenance eventPUT /eventos/:id- Update a maintenance eventDELETE /eventos/:id- Delete a maintenance event
Supporting Data
GET /tipos- List maintenance typesPOST /tipos- Create a new maintenance typeGET /condiciones- List condition typesGET /proximos- Get upcoming maintenance scheduleGET /talleres- List workshops/talleres
Data Models
PlanMantenimiento
MantenimientoEvento
PlanCondicion
Quick Start Examples
Create a Maintenance Plan
Record a Maintenance Event
Get Upcoming Maintenance
Error Handling
The API returns standard HTTP status codes:200 OK- Successful GET/PUT request201 Created- Successful POST request204 No Content- Successful DELETE request400 Bad Request- Invalid request data500 Internal Server Error- Database or server error