Request Lifecycle
This guide walks you through the complete lifecycle of a transport request, from creation to completion or cancellation.Overview
A transport request (solicitud) goes through several states:- PENDIENTE_APROBACION - Initial state when created
- APROBADA - Approved by the approver
- RECHAZADA - Rejected by the approver
- EN_PROCESO - At least one mission is in progress
- COMPLETADA - All missions completed successfully
- CANCELADA - Request was cancelled
Creating a Request
Prepare request data
Gather all required information:
- Requester and approver IDs
- Department, service type, and priority
- Service date and time
- Passenger count and names
- At least one location (origin/destinations)
Submit the request
Send a POST request to
/solicitud with the complete data.The request code is automatically generated in the format
SOL-{YEAR}-{MONTH}-{SEQUENTIAL}.
The initial state is always PENDIENTE_APROBACION.Updating a Request
Requests can only be updated while in PENDIENTE_APROBACION state.cURL
Approval Flow
Approving a Request
Missions are NOT automatically created when approving a request. The approver must manually create missions later through the Mission module.
Rejecting a Request
A rejection reason is mandatory.State Transitions
Automatic State Changes
The request state automatically transitions based on mission status:- APROBADA → EN_PROCESO: When the first mission is started
- EN_PROCESO → COMPLETADA: When all missions are completed
Viewing State History
Track all state changes with timestamps and reasons:cURL
Response
Cancelling a Request
Requests can be cancelled unless they’re already in a final state.Deleting a Request
Requests can only be deleted (soft delete) when in PENDIENTE_APROBACION state.cURL
This performs a soft delete. The record remains in the database but is marked as deleted and excluded from normal queries.
Filtering and Searching
Retrieve requests with powerful filtering:cURL
idEstadoSolicitud- Filter by state IDcodigoEstado- Filter by state code (PENDIENTE_APROBACION, APROBADA, etc.)idDepartamento- Filter by departmentidUsuarioSolicitante- Filter by requesteridUsuarioAprobador- Filter by approveridTipoServicio- Filter by service typeidTipoPrioridad- Filter by priorityfechaDesde/fechaHasta- Date range (YYYY-MM-DD)busqueda- Search in code, subject, and description
Use
/solicitud/todos/lista for unpaginated results (useful for dropdowns and exports).Best Practices
Validate dates
Validate dates
The service date (
fechaServicioRequerido) cannot be in the past. The API validates this automatically.Define clear locations
Define clear locations
Always include at least one origin location (
esOrigen: true) and specify the order for each location.Track state changes
Track state changes
Use the
/historico endpoint to audit all state transitions and understand the approval flow.Handle missions separately
Handle missions separately
Remember that approving a request does NOT create missions. See the Mission Management guide for creating missions.