Products - Update API

Update the specified Product.

Method PUT

Parameters

Name Details Type Required
id The ID of the Product. integer Yes

Body

{
    "name": "string",
    "description": "string",
    "price": "float",
    "category_id": "integer"
}

How to Use

fetch('https://simplecrudapi.com/api/products/1', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'Canon EOS 5D Mark IV',
    description: 'Updated The Canon EOS 5D Mark IV is a professional DSLR camera that combines outstanding image quality, advanced features, and exceptional performance. It’s designed for professional photographers who need high resolution and advanced video features.',
    price: 2499.99,
    category_id: 2,
    quantity: 35,
    is_available: true
  })
})
	.then(response => response.json())
	.then(data => console.log(data))
	.catch(error => console.error(error))

Response

{
    "data": {
        "id": 1,
        "name": "Canon EOS 5D Mark IV",
        "description": "Updated The Canon EOS 5D Mark IV is a professional DSLR camera that combines outstanding image quality, advanced features, and exceptional performance. It\u2019s designed for professional photographers who need high resolution and advanced video features.",
        "price": 2499.99,
        "quantity": 35,
        "is_available": true,
        "category": {
            "id": 2,
            "name": "Cameras",
            "description": "Photography and video equipment for capturing high-quality images and videos.",
            "created_at": "2024-11-09T19:53:48+00:00",
            "updated_at": "2024-11-09T19:53:48+00:00"
        },
        "created_at": "2024-11-09T20:12:15.000000Z",
        "updated_at": "2024-11-09T20:12:15.000000Z"
    }
}

Try Now

fetch('https://simplecrudapi.com/api/products/1', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'Canon EOS 5D Mark IV',
    description: 'Updated The Canon EOS 5D Mark IV is a professional DSLR camera that combines outstanding image quality, advanced features, and exceptional performance. It’s designed for professional photographers who need high resolution and advanced video features.',
    price: 2499.99,
    category_id: 2,
    quantity: 35,
    is_available: true
  })
})
	.then(response => response.json())
	.then(data => console.log(data))
	.catch(error => console.error(error))

Test with Open API

View Open API

Previous
Tags API

Our Proudly Sponsors 🎉

© 2025 Simple CRUD API. All rights reserved.