Get All Warehouses
Retrieves a list of all warehouses in the system.
Response
Returns an array of warehouse objects.
Unique identifier for the warehouse
Geographic latitude coordinate of the warehouse location
Geographic longitude coordinate of the warehouse location
Country where the warehouse is located
List of product items available in stockUnique identifier for the product item
Example Request
curl -X GET http://localhost:8080/api/warehouses
Example Response
[
{
"id": "WH001",
"latitude": 40.7589,
"longitude": -73.9851,
"country": "USA",
"stock": [
{
"id": "550e8400-e29b-41d4-a716-446655440010",
"productId": "PROD001",
"size": "M",
"quantity": 500
},
{
"id": "550e8400-e29b-41d4-a716-446655440011",
"productId": "PROD002",
"size": "L",
"quantity": 300
}
]
}
]
Get Warehouse By ID
Retrieves detailed information about a specific warehouse.
Path Parameters
The unique identifier of the warehouse to retrieve
Response
Returns a single warehouse object with the same structure as shown in the Get All Warehouses endpoint.
Unique identifier for the warehouse
Geographic latitude coordinate of the warehouse location
Geographic longitude coordinate of the warehouse location
Country where the warehouse is located
List of product items available in stock
Example Request
curl -X GET http://localhost:8080/api/warehouses/WH001
Example Response
{
"id": "WH001",
"latitude": 40.7589,
"longitude": -73.9851,
"country": "USA",
"stock": [
{
"id": "550e8400-e29b-41d4-a716-446655440010",
"productId": "PROD001",
"size": "M",
"quantity": 500
},
{
"id": "550e8400-e29b-41d4-a716-446655440011",
"productId": "PROD002",
"size": "L",
"quantity": 300
}
]
}
Error Responses
Warehouse Not Found (404)
Returned when the requested warehouse ID does not exist.
{
"error": "Warehouse not found",
"message": "Warehouse with ID WH001 does not exist"
}