Skip to main content

Mission Management

The Mission API provides endpoints to manage the complete lifecycle of vehicle missions, from creation through completion or cancellation.

Mission Lifecycle

Missions follow a defined state flow:
  1. PROGRAMADA (Scheduled) - Initial state when created
  2. EN_EJECUCION (In Progress) - After starting the mission
  3. COMPLETADA (Completed) - Successfully finished
  4. CANCELADA (Cancelled) - Terminated before completion

Available Operations

Create Mission

Create a new mission for an approved request

Assign Resources

Assign vehicle and driver to a scheduled mission

Start Mission

Begin executing a scheduled mission

Finish Mission

Complete a mission in progress

Cancel Mission

Cancel a mission with reason

List Missions

Get missions with pagination and filters

Get Mission

Retrieve mission details and mileage

Update Mission

Modify a scheduled mission

Delete Mission

Soft delete a scheduled mission

Key Features

  • Multi-stop Support: Missions can include multiple stops with estimated arrival times
  • Resource Assignment: Validates vehicle and driver availability before assignment
  • Mileage Tracking: Records initial and final mileage for each mission
  • Fuel Consumption: Automatically calculates fuel consumption in gallons
  • State Validation: Enforces valid state transitions throughout the lifecycle
  • Request Integration: Automatically updates parent request status based on mission states

Common Response Codes

  • 200 - Success
  • 201 - Created successfully
  • 404 - Resource not found
  • 409 - Conflict (invalid state transition or resource already assigned)
  • 422 - Validation error
  • 500 - Internal server error

Build docs developers (and LLMs) love