PATCH /products/{id}

Path parameters

  • id string Required

    The CUID of the product to update

application/json

Body Required

  • name string Required
  • description string | null
  • image string | null

    URL of the product image

  • price number(double) Required

    Minimum value is 0.

Responses

  • 200 application/json

    Product updated successfully

    Hide response attributes Show response attributes object
    • id string Required

      Unique identifier for the product (CUID)

    • name string Required

      Name of the product

    • description string | null

      Description of the product

    • image string | null

      URL of the product image

    • price number(double) Required

      Price of the product

  • 401 application/json

    Unauthorized

    Hide response attribute Show response attribute object
    • message string Required

      A message describing the error

  • 404 application/json

    Product not found

    Hide response attribute Show response attribute object
    • message string Required

      A message describing the error

  • 500 application/json

    Internal Server Error

    Hide response attribute Show response attribute object
    • message string Required

      A message describing the error

PATCH /products/{id}
curl \
 --request PATCH 'http://localhost:3000/api/v1/products/{id}' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{"name":"Sample Product","image":"https://example.com/image.jpg","price":29.99,"description":"This is a great product."}'
Request example
{
  "name": "Sample Product",
  "image": "https://example.com/image.jpg",
  "price": 29.99,
  "description": "This is a great product."
}
Response examples (200)
{
  "id": "string",
  "name": "string",
  "description": "string",
  "image": "string",
  "price": 42.0
}
Response examples (401)
{
  "message": "Product not found"
}
Response examples (404)
{
  "message": "Product not found"
}
Response examples (500)
{
  "message": "Product not found"
}