List Generators
GET /api/generators
Retrieve all generators, optionally filtered by collection center.
Query Parameters
Filter generators by collection center ID. If not provided, uses the active center from configuration.
Response
Returns an array of generator objects sorted by name.
Unique generator identifier
Generator name (business name)
Tax identification number (RIF)
Collection mode (e.g., “Puerta a Puerta”, “Centro de Acopio”)
Associated collection center ID
Timestamp when generator was created
Example Request
curl http://localhost:4000/api/generators?collectionCenterId=center-1
Example Response
[
{
"id": "gen-1",
"name": "Restaurant El Sabor",
"rif": "J-12345678-9",
"phone": "+58 414 1234567",
"address": "Av. Principal, Local 5",
"sector": "Centro",
"collection_mode": "Puerta a Puerta",
"collection_center_id": "center-1",
"created_at": "2026-01-15T10:00:00Z"
},
{
"id": "gen-2",
"name": "Taller Mecánico Los Tres",
"rif": "J-98765432-1",
"phone": "+58 424 9876543",
"address": "Calle 5, Galpón 3",
"sector": "Industrial",
"collection_mode": "Centro de Acopio",
"collection_center_id": "center-1",
"created_at": "2026-02-01T14:30:00Z"
}
]
Get Generator by ID
GET /api/generators/:id
Retrieve a single generator by its ID.
Path Parameters
Response
Returns a single generator object or null if not found.
Example Request
curl http://localhost:4000/api/generators/gen-1
Example Response
{
"id": "gen-1",
"name": "Restaurant El Sabor",
"rif": "J-12345678-9",
"phone": "+58 414 1234567",
"address": "Av. Principal, Local 5",
"sector": "Centro",
"collection_mode": "Puerta a Puerta",
"collection_center_id": "center-1",
"created_at": "2026-01-15T10:00:00Z"
}
Create Generator
POST /api/generators
Create a new waste oil generator.
Request Body
Unique generator identifier (UUID)
Generator name (business name)
Tax identification number (RIF)
Collection mode (optional)
Associated collection center ID (optional)
Response
Returns the created generator object with created_at timestamp.
Example Request
curl -X POST http://localhost:4000/api/generators \
-H "Content-Type: application/json" \
-d '{
"id": "gen-new-1",
"name": "Panadería La Espiga",
"rif": "J-55555555-5",
"phone": "+58 412 5555555",
"address": "Calle 10, Edificio A",
"sector": "Norte",
"collectionMode": "Puerta a Puerta",
"collectionCenterId": "center-1"
}'
Example Response
{
"id": "gen-new-1",
"name": "Panadería La Espiga",
"rif": "J-55555555-5",
"phone": "+58 412 5555555",
"address": "Calle 10, Edificio A",
"sector": "Norte",
"collection_mode": "Puerta a Puerta",
"collection_center_id": "center-1",
"created_at": "2026-03-09T15:30:00Z"
}
Update Generator
PUT /api/generators/:id
Update an existing generator.
Path Parameters
Request Body
Tax identification number (RIF)
Associated collection center ID
Response
Returns the updated generator object.
Example Request
curl -X PUT http://localhost:4000/api/generators/gen-1 \
-H "Content-Type: application/json" \
-d '{
"name": "Restaurant El Sabor (Nueva Sede)",
"rif": "J-12345678-9",
"phone": "+58 414 1234567",
"address": "Av. Bolívar, Local 12",
"sector": "Centro",
"collectionMode": "Puerta a Puerta",
"collectionCenterId": "center-1"
}'
Delete Generator
DELETE /api/generators/:id
Delete a generator by its ID.
Deleting a generator will cascade delete all associated tickets due to the foreign key constraint.
Path Parameters
Response
Returns true if deletion was successful
Example Request
curl -X DELETE http://localhost:4000/api/generators/gen-1
Example Response
Error Response
{
"error": "DB delete error"
}