Skip to main content
DELETE
/
api
/
Producto
/
Eliminar
/
{id}
Delete Product
curl --request DELETE \
  --url https://api.example.com/api/Producto/Eliminar/{id}
{
  "status": true,
  "value": true,
  "msg": "<string>"
}

Endpoint

DELETE /api/Producto/Eliminar/{id}
Deletes a product from the system using its unique identifier.

Path Parameters

id
integer
required
The unique identifier of the product to delete

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 deleted
  • true - Product was found and deleted
  • false - Product was not found or deletion failed
msg
string
Error message (only populated when status is false)

Example Request

curl -X DELETE "http://localhost:5000/api/Producto/Eliminar/15" \
  -H "Content-Type: application/json"

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 deleted successfully
  • status: true, value: false - Product not found (no deletion performed)
  • status: false - An error occurred (check msg field for details)

Important Notes

Cascading Effects

Deleting a product may fail if:
  • The product is referenced in existing sales transactions
  • The product has related records in other tables
In these cases, consider deactivating the product instead of deleting it by using the Update Product endpoint with esActivo: 0.

Alternative: Soft Delete

For better data integrity and audit trails, it’s recommended to use soft delete by setting the product’s esActivo field to 0 instead of permanently deleting it:
curl -X PUT "http://localhost:5000/api/Producto/Editar" \
  -H "Content-Type: application/json" \
  -d '{
    "idProducto": 15,
    "esActivo": 0,
    ...
  }'

Path Parameter Validation

  • The id parameter must be a positive integer
  • Non-integer values will result in a 400 Bad Request

Build docs developers (and LLMs) love