Overview
The Drivers (Choferes) API allows you to manage driver information including personal details, identification, and location data. Drivers are linked to user accounts and can be associated with vehicles for campaign participation.Base Endpoint
Model Structure
Chofer Model
The Chofer model represents a driver in the system with the following fields:Unique identifier for the driver (auto-generated primary key)
Foreign key reference to the Usuario (User) model. Links the driver to their user account
Driver’s identification number (cedula). Maximum 10 characters
Driver’s first name. Maximum 20 characters
Driver’s last name. Maximum 20 characters
Driver’s date of birth in ISO 8601 format (YYYY-MM-DD)
Driver’s gender represented as an integer:
0: Female1: Male
Foreign key reference to the Ciudad (City) model. Defaults to 1
Foreign key reference to the Pais (Country) model. Defaults to 1
Current status of the driver:
0: Inactive1: Active3: Disabled
Endpoints
List All Drivers
GET /Database/Database/choferes/
Retrieve a list of all drivers in the system
Response
Driver’s unique identifier
Associated user account ID
Driver’s identification number
Driver’s first name
Driver’s last name
Driver’s date of birth
Driver’s gender (0: Female, 1: Male)
City ID where the driver is located
Country ID where the driver is located
Driver’s status (0: Inactive, 1: Active, 3: Disabled)
Example Response
Get Single Driver
GET /Database/Database/choferes/{id}/
Retrieve details of a specific driver by ID
Path Parameters
The unique identifier of the driver
Example Response
Create New Driver
POST /Database/Database/choferes/
Create a new driver in the system
Request Body
User account ID to associate with this driver
Driver’s identification number (max 10 characters)
Driver’s first name (max 20 characters)
Driver’s last name (max 20 characters)
Driver’s date of birth (YYYY-MM-DD)
Driver’s gender (0 or 1)
City ID (defaults to 1 if not provided)
Country ID (defaults to 1 if not provided)
Driver status (0, 1, or 3)
Example Request
Example Response
Update Driver
PUT /Database/Database/choferes/{id}/
Update an existing driver’s information (full update)
Path Parameters
The unique identifier of the driver to update
Request Body
All fields from the create request are required for a full update.Example Request
Partial Update Driver
PATCH /Database/Database/choferes/{id}/
Partially update a driver’s information
Path Parameters
The unique identifier of the driver to update
Request Body
Include only the fields you want to update.Example Request
Delete Driver
DELETE /Database/Database/choferes/{id}/
Delete a driver from the system
Path Parameters
The unique identifier of the driver to delete
Response
Relationships
Related Models
The Chofer model has foreign key relationships with:- Usuario (
id_usuario): Links to the user account. Each driver must have an associated user account with authentication credentials - Ciudad (
id_ciudad): Links to the city where the driver is located - Pais (
id_pais): Links to the country where the driver is located
Referenced By
Drivers are referenced by:- Vehiculo model via
id_chofer- Links vehicles to their drivers - IngresoConductorCampana model - Associates drivers with advertising campaigns
Business Logic
Driver Registration Flow
- A user account must be created first with
rol_usuarioset to driver role - The Chofer record is then created linking to the user via
id_usuario - Drivers can register vehicles under their account
- Drivers can apply to participate in advertising campaigns
Status Management
- Active (1): Driver can participate in campaigns and use the system
- Inactive (0): Driver account exists but is not currently active
- Disabled (3): Driver has been disabled by administrators and cannot access the system
Validation Notes
cedula_chofershould be exactly 10 digits for most Latin American countriesfecha_nacimientoshould represent an age of 18 years or older for driver eligibilityid_usuariomust reference an existing user with appropriate driver role- The same
cedula_chofershould not be registered multiple times