Skip to main content
PUT
Update Product

Endpoint

Authentication

Admin access required. Only users with the ADMIN role can update products.

Path Parameters

number
required
The unique identifier of the product to update

Request Headers

Request Body

This endpoint accepts multipart/form-data to support image upload. All fields are optional - only include fields you want to update.
string
Product name (minimum 3 characters)
string
Product description (minimum 10 characters)
number
Product price (must be positive)
number
Original price (for displaying discounts)
number
Stock quantity (must be non-negative integer)
number
Category ID to associate with this product
number
Brand ID to associate with this product
number
Product weight in kg
number
Product height in cm
number
Product width in cm
number
Product depth in cm
Whether this product should be featured
file
Product image file (uploaded as multipart form data). If provided, replaces the existing image.

Response

boolean
Indicates if the product was updated successfully
object
The updated product object
number
Unique product identifier
string
Product name
string
Product description
decimal
Product price
decimal
Original price
number
Stock quantity
string
Product image URL
Featured status
decimal
Weight in kg
number
Height in cm
number
Width in cm
number
Depth in cm
number
Category ID
number
Brand ID
datetime
Creation timestamp
datetime
Last update timestamp

Example Request

Example Response

Error Responses

Invalid Product ID

Validation Error

Unauthorized

Server Error

Notes

  • Only include fields you want to update in the request body
  • If a new image is uploaded, it will replace the existing image
  • The updatedAt timestamp is automatically updated
  • Product dimensions and weight are important for shipping calculations