Skip to main content
PUT
/
api
/
Producto
/
Editar
Update Product
curl --request PUT \
  --url https://api.example.com/api/Producto/Editar \
  --header 'Content-Type: application/json' \
  --data '
{
  "idProducto": 123,
  "nombre": "<string>",
  "idCategoria": 123,
  "stock": 123,
  "precio": "<string>",
  "esActivo": 123,
  "descripcionCategoria": "<string>"
}
'
{
  "status": true,
  "value": true,
  "msg": "<string>"
}

Endpoint

PUT /api/Producto/Editar
Updates an existing product with the provided information. All fields of the product can be modified.

Request Body

idProducto
integer
required
ID of the product to update
nombre
string
required
Updated product name
idCategoria
integer
required
Updated category ID
stock
integer
required
Updated stock quantity
precio
string
required
Updated product price (formatted as string, e.g., “99.99”)
esActivo
integer
required
Updated active status (1 = active, 0 = inactive)
descripcionCategoria
string
Read-only field, automatically updated from category

Response

The response is wrapped in a Response<T> object containing a boolean success indicator.
status
boolean
required
Indicates whether the request was processed successfully
value
boolean
required
Indicates whether the product was actually updated
  • true - Product was found and updated
  • false - Product was not found or update failed
msg
string
Error message (only populated when status is false)

Example Request

curl -X PUT "http://localhost:5000/api/Producto/Editar" \
  -H "Content-Type: application/json" \
  -d '{
    "idProducto": 15,
    "nombre": "Monitor Samsung 27 4K",
    "idCategoria": 1,
    "stock": 30,
    "precio": "399.99",
    "esActivo": 1
  }'

Example Response

{
  "status": true,
  "value": true,
  "msg": null
}

Response Status

This endpoint always returns HTTP 200. Check both the status and value fields:
  • status: true, value: true - Product updated successfully
  • status: true, value: false - Product not found (no update performed)
  • status: false - An error occurred (check msg field for details)

Validation

  • Product ID must reference an existing product
  • Product name must not be empty
  • Category ID must reference an existing category
  • Stock must be a non-negative integer
  • Price must be a valid decimal number formatted as a string

Notes

  • All fields are required in the request body
  • To deactivate a product, set esActivo to 0
  • Category changes are allowed and will update the descripcionCategoria automatically

Build docs developers (and LLMs) love