Skip to main content

Get All Warehouses

Retrieves a list of all warehouses in the system.

Response

Returns an array of warehouse objects.
id
string
required
Unique identifier for the warehouse
latitude
number
required
Geographic latitude coordinate of the warehouse location
longitude
number
required
Geographic longitude coordinate of the warehouse location
country
string
required
Country where the warehouse is located
stock
array
required
List of product items available in stock
id
string
Unique identifier for the product item
productId
string
Product identifier
size
string
Product size
quantity
integer
Available quantity

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

id
string
required
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.
id
string
required
Unique identifier for the warehouse
latitude
number
required
Geographic latitude coordinate of the warehouse location
longitude
number
required
Geographic longitude coordinate of the warehouse location
country
string
required
Country where the warehouse is located
stock
array
required
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"
}

Build docs developers (and LLMs) love