List Collection Centers
GET /api/collection-centers
Retrieve all collection centers sorted by name.
Response
Returns an array of collection center objects.
Show Collection Center Object
Unique collection center identifier
State/province (used in ticket number generation)
Whether the center is currently active
Timestamp when center was created
Example Request
curl http://localhost:4000/api/collection-centers
Example Response
[
{
"id" : "center-1" ,
"name" : "Centro Aragua" ,
"state" : "Aragua" ,
"city" : "Maracay" ,
"address" : "Zona Industrial La Floresta" ,
"is_active" : true ,
"created_at" : "2026-01-01T08:00:00Z"
},
{
"id" : "center-2" ,
"name" : "Centro Carabobo" ,
"state" : "Carabobo" ,
"city" : "Valencia" ,
"address" : "Zona Industrial San Vicente" ,
"is_active" : true ,
"created_at" : "2026-01-15T10:00:00Z"
}
]
Create Collection Center
POST /api/collection-centers
Create a new collection center.
Request Body
Unique collection center identifier (UUID)
State/province (important: used in ticket number generation as 3-letter code)
Whether the center is active
Response
Returns the created collection center object with created_at timestamp.
The state field is used to generate the state code in ticket numbers (e.g., “Aragua” → “ARA”).
The first 3 letters are used after removing accents and non-alphabetic characters.
Example Request
curl -X POST http://localhost:4000/api/collection-centers \
-H "Content-Type: application/json" \
-d '{
"id": "center-new-1",
"name": "Centro Miranda",
"state": "Miranda",
"city": "Los Teques",
"address": "Carretera Panamericana, Km 15",
"isActive": true
}'
Example Response
{
"id" : "center-new-1" ,
"name" : "Centro Miranda" ,
"state" : "Miranda" ,
"city" : "Los Teques" ,
"address" : "Carretera Panamericana, Km 15" ,
"is_active" : true ,
"created_at" : "2026-03-09T11:00:00Z"
}
Update Collection Center
PUT /api/collection-centers/:id
Update an existing collection center.
Path Parameters
Request Body
Whether the center is active
Response
Returns the updated collection center object.
Example Request
curl -X PUT http://localhost:4000/api/collection-centers/center-1 \
-H "Content-Type: application/json" \
-d '{
"name": "Centro Aragua - Sede Principal",
"state": "Aragua",
"city": "Maracay",
"address": "Zona Industrial La Floresta, Galpón 8",
"isActive": true
}'
Example Response
{
"id" : "center-1" ,
"name" : "Centro Aragua - Sede Principal" ,
"state" : "Aragua" ,
"city" : "Maracay" ,
"address" : "Zona Industrial La Floresta, Galpón 8" ,
"is_active" : true ,
"created_at" : "2026-01-01T08:00:00Z"
}
Delete Collection Center
DELETE /api/collection-centers/:id
Delete a collection center by its ID.
Deleting a collection center will set the collection_center_id to NULL in related records (generators, vehicles, tickets, dispatches, members) due to ON DELETE SET NULL foreign key constraints.
Path Parameters
Response
Returns true if deletion was successful
Example Request
curl -X DELETE http://localhost:4000/api/collection-centers/center-2
Example Response
Error Response
{
"error" : "DB delete error"
}