Skip to main content

Get All Products

Retrieves a list of all products in the system.

Response

Returns an array of product objects.
id
string
required
Unique identifier for the product
brandId
string
required
Brand identifier for the product
sizes
string[]
required
Available sizes for the product

Example Request

curl -X GET http://localhost:8080/api/products

Example Response

[
  {
    "id": "PROD001",
    "brandId": "BRAND001",
    "sizes": ["S", "M", "L", "XL"]
  },
  {
    "id": "PROD002",
    "brandId": "BRAND002",
    "sizes": ["M", "L"]
  }
]

Get Product By ID

Retrieves detailed information about a specific product.

Path Parameters

id
string
required
The unique identifier of the product to retrieve

Response

Returns a single product object.
id
string
required
Unique identifier for the product
brandId
string
required
Brand identifier for the product
sizes
string[]
required
Available sizes for the product

Example Request

curl -X GET http://localhost:8080/api/products/PROD001

Example Response

{
  "id": "PROD001",
  "brandId": "BRAND001",
  "sizes": ["S", "M", "L", "XL"]
}

Error Responses

Product Not Found (404)

Returned when the requested product ID does not exist.
{
  "error": "Product not found",
  "message": "Product with ID PROD001 does not exist"
}

Build docs developers (and LLMs) love