This endpoint updates a product identified by its UUID. All fields are optional - you only need to include the fields you want to update.
Path Parameters
Product UUID identifierValidation: Must be a valid UUID format
Request Body
All fields are optional. Include only the fields you want to update.
Product name. Must be at least 3 characters long if provided.Validation: Minimum length of 3 characters
Product description. Must be between 3 and 3000 characters if provided.Validation: Minimum 3 characters, maximum 3000 characters
Available stock quantity. Must be a non-negative integer if provided.Validation: Integer, minimum value of 0
Product price. Must be a non-negative integer if provided.Validation: Integer, minimum value of 0
Category ID. Must reference an existing category if provided.Validation: Integer, minimum value of 0
Request Example
{
"name": "Coca cola",
"description": "Bebida gasificada de 2ltr",
"stock": 40,
"price": 3000,
"categoriesID": 1
}
Or update just specific fields:
{
"stock": 50,
"price": 3200
}
Response
Indicates if an error occurred during the request
Response message (“product modify sucessfully” on success)
Success Response Example (200)
{
"error": false,
"msg": "product modify sucessfully"
}
Error Responses
400 - Invalid UUID
{
"error": true,
"msg": "the id is invalid"
}
400 - Empty Body
{
"error": true,
"msg": "request body is empty"
}
{
"error": true,
"msg": "the data format is invalid"
}
409 - Conflict
Returned when the product is not found or a database constraint is violated.
{
"error": true,
"msg": "Error message describing the issue"
}
Validation Rules
Fields are validated using “soft” validation (validateProductSoft) which only validates fields that are provided:
- name: String with minimum 3 characters (if provided)
- description: String with minimum 3 characters and maximum 3000 characters (if provided)
- price: Integer with minimum value 0 (if provided)
- stock: Integer with minimum value 0 (if provided)
- categoriesID: Integer with minimum value 0 (if provided, must reference existing category)