Skip to main content
POST
/
secured
/
update_products
curl --location 'http://localhost:8080/secured/update_products' \
--header 'Authorization: Bearer YOUR_JWT_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
  "clave": "PROD001",
  "linea": "Electronics Updated",
  "descripcion": "Updated description",
  "precio": 175.00,
  "existencias": 50,
  "unidad": "PCS",
  "typeWoo": "simple",
  "shortDescriptionWOO": "Updated short description",
  "descriptionWOO": "Updated full description",
  "categoryWOO": "Components"
}'
{
  "msg": "Actualizado con exito"
}
This endpoint updates all fields of an existing product identified by its clave (product key).

Authentication

This endpoint requires authentication. Include a valid JWT token in the Authorization header (raw token, no “Bearer” prefix).
Authorization
string
required
JWT token for authentication (raw token without Bearer prefix)

Request Body

clave
string
required
Unique product key/identifier of the product to update
linea
string
Product line
descripcion
string
Product description
precio
number
Product price
existencias
number
Stock quantity
unidad
string
Unit of entry/measurement
typeWoo
string
WooCommerce product type
shortDescriptionWOO
string
Short description for WooCommerce
descriptionWOO
string
Full description for WooCommerce
categoryWOO
string
WooCommerce category name

Response

msg
string
Success message: “Actualizado con exito”
curl --location 'http://localhost:8080/secured/update_products' \
--header 'Authorization: Bearer YOUR_JWT_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
  "clave": "PROD001",
  "linea": "Electronics Updated",
  "descripcion": "Updated description",
  "precio": 175.00,
  "existencias": 50,
  "unidad": "PCS",
  "typeWoo": "simple",
  "shortDescriptionWOO": "Updated short description",
  "descriptionWOO": "Updated full description",
  "categoryWOO": "Components"
}'
{
  "msg": "Actualizado con exito"
}

Error Codes

200
success
Product updated successfully
401
error
Unauthorized - Invalid or missing authentication token

Implementation Notes

  • The update is performed based on the claveProducto field (line 192 in cliente.js:192)
  • All fields are updated in a single SQL UPDATE statement
  • The endpoint expects the product to exist; if it doesn’t exist, the update will complete but affect 0 rows

Build docs developers (and LLMs) love