Endpoint
Authentication
Requires JWT authentication token with appropriate permissions.Path Parameters
The unique identifier of the fuel record to delete
Response
Returns a confirmation message upon successful deletion.Success confirmation message
Examples
Delete a Fuel Record
Success Response Example
Status Code:200 OK
Error Responses
400 Bad Request - Delete Failed
400 Bad Request - Record Not Found
401 Unauthorized
500 Internal Server Error
Important Notes
Permanent Deletion
- This operation permanently removes the record from the
tanqueotable - There is no soft delete or recovery mechanism
- Consider creating a backup or export before deleting important records
Foreign Key Constraints
- If the record is referenced by other tables, the deletion may fail
- Check for dependencies before attempting to delete
- The database will prevent deletion if it would violate referential integrity
Audit Trail
- Once deleted, the record and its audit information (
creado_por,actualizado_por) are permanently lost - Consider keeping an audit log outside the main table if you need to track deletions
Best Practices
Before Deleting
- Verify the record: Use Get By ID to confirm you’re deleting the correct record
- Check dependencies: Ensure the record is not referenced elsewhere
- Export data: Create a backup if needed for audit purposes
- Confirm authorization: Ensure the user has permission to delete this record
Alternative to Deletion
Instead of deleting, consider:- Adding a “status” field and marking records as “inactive” or “cancelled”
- Implementing soft deletes with a
deleted_attimestamp - Moving records to an archive table
Example Workflow
Verify Before Delete
Implementation Details
- The endpoint executes a
DELETESQL operation on thetanqueotable - Row Level Security (RLS) policies may restrict which records can be deleted based on user permissions
- The operation is atomic - either the record is deleted or an error is returned
- No cascade deletes are performed - related records in other tables remain unchanged
Related Endpoints
- Update Fuel Record - Modify a record instead of deleting
- List Fuel Records - View all records
- Create Fuel Record - Create a new record to replace the deleted one