TestingAPIs is still being built. If something breaks, email support@testingapis.com.

Update a product

PUThttps://api.testingapis.com/api/Products/{id}

Replaces title, price, description, category, image and inStock; rating is kept when omitted.

Parameters 1

NameTypeDescription
idrequiredpath · integer (int32)Product ID.

Request body

Optional. application/json, text/json, application/*+json, application/xml, text/xml, application/*+xml. Model: Product. The new field values.

Example body
{
  "title": "Wireless Noise-Cancelling Headphones",
  "price": 249.99,
  "description": "Over-ear headphones with 30hr battery life and active noise cancellation.",
  "category": "electronics",
  "image": "https://picsum.photos/seed/prod1/400/400",
  "rating": {"rate": 4.3, "count": 127},
  "inStock": true,
  "createdAt": "2025-06-12T10:30:00Z"
}

Responses

200
Updated; returns { message, data }.
404
The product does not exist.
500
Unexpected server error.

Example

Request
curl -X PUT "https://api.testingapis.com/api/Products/21" \
  -H "Content-Type: application/json" \
  -d '{"title": "Wireless Noise-Cancelling Headphones", "price": 249.99, "description": "Over-ear headphones with 30hr battery life and active noise cancellation.", "category": "electronics", "image": "https://picsum.photos/seed/prod1/400/400", "rating": {"rate": 4.3, "count": 127}, "inStock": true, "createdAt": "2025-06-12T10:30:00Z"}'
Response200 OK
{
  "message": "Product updated successfully",
  "data": {
    "id": 21,
    "title": "Wireless Noise-Cancelling Headphones",
    "price": 249.99,
    "description": "Over-ear headphones with 30hr battery life and active noise cancellation.",
    "category": "electronics",
    "image": "https://picsum.photos/seed/prod1/400/400",
    "rating": {"rate": 4.3, "count": 127},
    "inStock": true,
    "createdAt": "2025-06-12T10:30:00Z"
  }
}