Updates the information of an existing driver. All fields are optional - only provided fields will be updated.
Endpoint
PUT /motorista/{id_perfil}
Path Parameters
The unique profile ID of the driver to update
Request Body
All fields are optional. Only include fields you want to update.
Driver’s email address. Must be unique and valid format.
First name (max 100 characters)
Second name (max 100 characters)
Third name (max 100 characters)
First surname (max 100 characters)
Second surname (max 100 characters)
Married name (max 100 characters)
Contact phone number (max 20 characters)
National ID number. Format: ########-#. Must be unique.
Tax identification number (max 17 characters)
Residential address (max 500 characters)
Employee code (max 50 characters)
Nominal position (max 150 characters)
Functional position (max 150 characters)
Additional observations or notes
ID of the assigned department. Must reference an existing department.
ID of the license type. Must reference an existing license type.
Driver’s license number (max 50 characters)
License expiration date. Format: YYYY-MM-DD
ID of the availability status. Must reference an existing availability type.
Mobile device IMEI (max 100 characters). Must be unique if provided.
Response
Indicates if the operation was successful
Updated driver information with all current values
Example Request
{
"telefono": "7777-9999",
"direccion": "Nueva dirección, San Salvador",
"idTipoDisponibilidad": 2,
"fechaVencimientoLicencia": "2027-12-31"
}
Example Response
{
"success": true,
"message": "Motorista actualizado exitosamente",
"data": {
"idPerfil": 123,
"nombreCompleto": "JUAN CARLOS MARTINEZ LOPEZ",
"email": "[email protected]",
"telefono": "7777-9999",
"direccion": "Nueva dirección, San Salvador",
"disponibilidad": "Ocupado",
"fechaVencimientoLicencia": "2027-12-31"
}
}
Validations
The endpoint performs the following validations:
- Driver existence: Driver must exist and be active (not deleted)
- Unique constraints: If email, DUI, or IMEI are being changed, they must be unique
- Format validation:
- Email must match valid email format
- DUI must match format
########-#
- Dates must match format
YYYY-MM-DD
- Foreign key validation: If changing department, license type, or availability, the referenced records must exist
Status Codes
200: Driver updated successfully
400: Validation error (invalid format)
404: Driver not found or has been deleted
409: Conflict (duplicate email, DUI, or IMEI)
500: Internal server error
Error Response Examples
Driver Not Found
{
"success": false,
"message": "Motorista no encontrado o ha sido eliminado",
"data": null
}
Duplicate Email
{
"success": false,
"message": "El correo electrónico ya está registrado para otro motorista",
"data": null
}
{
"success": false,
"message": "La fecha debe tener el formato YYYY-MM-DD",
"data": null
}
Quick Availability Update
For updating only the driver’s availability status, use the dedicated PATCH endpoint for better performance.
Endpoint
PATCH /motorista/{id_perfil}/disponibilidad
Request Body
ID of the new availability status
Example Request
{
"idTipoDisponibilidad": 2
}
Example Response
{
"success": true,
"message": "Disponibilidad del motorista actualizada exitosamente",
"data": {
"idPerfil": 123,
"nombreCompleto": "JUAN CARLOS MARTINEZ LOPEZ",
"idTipoDisponibilidad": 2,
"disponibilidad": "Ocupado"
}
}
Use Cases
- Quick status changes during mission assignments
- Marking drivers as unavailable for maintenance
- Updating availability from mobile apps
- Real-time status updates in dispatch systems
Status Codes
200: Availability updated successfully
404: Driver not found
500: Internal server error