Overview
ThemanageZones endpoint provides Create, Read, Update, and Delete operations for parking zones. Zones are used to organize parking spots into logical groups (e.g., “Federico Froebel”, “Interior DUOC”).
Endpoint
Authentication
CORS-enabled endpoint with wildcard origin (*). Should be restricted to admin users in production.
Request Body
All operations require anaction parameter. Additional fields depend on the action.
The operation to perform:
create: Create a new zoneupdate: Update an existing zonedelete: Delete a zone
Create Action
Display name of the zone (e.g., “Federico Froebel”)
Custom zone ID. If not provided, generates
zone_{timestamp}Display order for sorting zones. Defaults to
999 (end of list)Description of the zone. Defaults to empty string
Color code for UI display. Defaults to
"blue"Update Action
ID of the zone to update
New display name of the zone
New display order (optional)
New description (optional)
New color code (optional)
Delete Action
ID of the zone to delete
Response
Indicates whether the operation was successful
Result message describing the operation
The created/updated zone object (not present for delete operations)
Error message (only present on failure)
Success Responses
- 200 OK - Operation completed successfully
- 204 No Content - OPTIONS preflight response
Error Responses
- 400 Bad Request - Missing required fields or invalid action
- 500 Internal Server Error - Database or server error
Code Examples
Create Zone
Update Zone
Delete Zone
Response Examples
Create Success
Update Success
Delete Success
Error Examples
Firestore Data Structure
Zone documents inparking_zones collection:
Update Behavior
- Only provided fields are updated (partial updates)
updated_attimestamp is always set- Undefined fields are ignored (not deleted)
- To delete a field, explicitly set it to
nullor empty string
Zone Deletion Considerations
Before deleting a zone:- Update all spots to remove
zone_idor assign to a different zone - Or implement cascade deletion logic in your application
Related Endpoints
- Get Zones - Fetch all zones
- Create Parking Spot - Assign spots to zones
- Get Occupancy History - View analytics by zone