Locations API
Locations API
Section titled “Locations API”Manage storage locations.
List Locations
Section titled “List Locations”Get all locations with item counts.
Endpoint
Section titled “Endpoint”GET /api/locationsResponse
Section titled “Response”{ "locations": [ { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Office", "description": "Main office area", "_count": { "items": 12 } }, { "id": "660e8400-e29b-41d4-a716-446655440001", "name": "Garage", "description": "Storage area in garage", "_count": { "items": 25 } } ]}Create Location
Section titled “Create Location”Add a new location.
Endpoint
Section titled “Endpoint”POST /api/locationsRequest Body
Section titled “Request Body”{ "name": "Garage Shelf A", "description": "Top shelf in the garage"}Fields
Section titled “Fields”| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Location name (unique) |
description | string | No | Additional details |
Response
Section titled “Response”{ "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Garage Shelf A", "description": "Top shelf in the garage"}Errors
Section titled “Errors”| Code | Message |
|---|---|
| 400 | Location already exists |
Update Location
Section titled “Update Location”Modify an existing location.
Endpoint
Section titled “Endpoint”PUT /api/locations/[id]Request Body
Section titled “Request Body”{ "name": "Garage - Shelf A", "description": "Updated description"}Response
Section titled “Response”Returns the updated location.
Delete Location
Section titled “Delete Location”Remove a location.
Endpoint
Section titled “Endpoint”DELETE /api/locations/[id]Response
Section titled “Response”{ "success": true}Note: Items Not Deleted Deleting a location does not delete its items. Items will have no assigned location.
Location Naming Conventions
Section titled “Location Naming Conventions”Consider using hierarchical naming for complex storage:
Building > Room > Area > Specific LocationExamples
Section titled “Examples”| Name | Description |
|---|---|
Home > Garage > Shelf A | Specific shelf |
Office > Desk > Drawer 1 | Office desk drawer |
Storage Unit 42 | External storage |
Bedroom Closet | Simple location |