Mission Management
Missions represent the actual execution of approved transport requests. This guide covers the complete mission lifecycle: creation, assignment, execution, and completion.Mission States
Missions flow through these states:- PROGRAMADA - Scheduled but not yet assigned or started
- EN_EJECUCION - Mission has started
- EN_RUTA_RECOGIDA - En route to pick up passengers
- EN_RUTA_REGRESO - Returning from destination
- EN_ESPERA - Waiting at a location
- COMPLETADA - Mission completed successfully
- CANCELADA - Mission was cancelled
Creating a Mission
Missions are created for approved requests.Creating Missions with Multiple Stops
For complex routes with multiple destinations:cURL
Assigning Vehicle and Driver
Once created, assign a vehicle and driver to the mission.Starting a Mission
When the driver is ready to depart:Automatic state changes:
- The mission changes from PROGRAMADA to EN_EJECUCION
- If the request is still APROBADA, it automatically changes to EN_PROCESO
Validations
- Mission must be in PROGRAMADA state
- Vehicle and driver must already be assigned
- Starting mileage cannot be less than the vehicle’s last recorded mileage
Completing a Mission
When the mission is finished:Automatic Calculations
The system automatically calculates:- KilometrajeRecorrido =
kilometrajeFin - kilometrajeInicio - CombustibleConsumidoGalones =
combustibleInicialGalones - combustibleFinalGalones
Request Completion
When all missions of a request are COMPLETADA, the request automatically changes to COMPLETADA state.
Validations
- Mission must be in EN_EJECUCION, EN_RUTA_RECOGIDA, EN_RUTA_REGRESO, or EN_ESPERA
- Final mileage cannot be less than starting mileage
- Final fuel must be between 0 and initial fuel
Tracking Mission Progress
Get Mission by ID
Retrieve complete mission details including stops and invoices:cURL
List Missions by Request
Get all active missions for a specific request:cURL
Check Vehicle Mileage
Before starting a mission, verify the vehicle’s last recorded mileage:cURL
Response
If the vehicle has no completed missions,
ultimoKilometraje returns 0.Updating a Mission
Missions can only be updated while in PROGRAMADA state:cURL
Cancelling a Mission
Missions can be cancelled unless already completed:A cancellation reason is mandatory. Missions cannot be cancelled if already COMPLETADA or CANCELADA.
Filtering and Searching
Retrieve missions with advanced filters:cURL
idSolicitud- Filter by requestidEstadoMision- Filter by mission state IDcodigoEstado- Filter by state code (PROGRAMADA, EN_EJECUCION, etc.)idVehiculo- Filter by vehicleidMotorista- Filter by driverfechaDesde/fechaHasta- Date range (YYYY-MM-DD)busqueda- General search
Deleting a Mission
Missions can only be deleted (soft delete) when in PROGRAMADA state:cURL
Best Practices
Verify vehicle availability
Verify vehicle availability
Before assigning, check that the vehicle doesn’t have overlapping missions on the same date.
Check driver schedule
Check driver schedule
Similarly, ensure the driver is not already assigned to another mission on the same date.
Record accurate mileage
Record accurate mileage
Always verify the vehicle’s last mileage reading before starting a mission to avoid validation errors.
Track fuel consumption
Track fuel consumption
Record fuel levels accurately at start and end to enable proper consumption tracking and reporting.
Document incidents
Document incidents
Use the
incidencias field when completing missions to document any issues, delays, or noteworthy events.Use multiple stops for complex routes
Use multiple stops for complex routes
For missions with several destinations, use the
paradas array to define the complete route with estimated times.