Skip to main content
PUT
/
api
/
categorias
/
{nombre}
Update Category
curl --request PUT \
  --url https://api.example.com/api/categorias/{nombre} \
  --header 'Content-Type: application/json' \
  --data '
{
  "nombre": "<string>",
  "slug": "<string>"
}
'
{
  "200": {},
  "400": {},
  "401": {},
  "403": {},
  "404": {},
  "categoria_id": 123,
  "nombre": "<string>",
  "slug": "<string>",
  "productos": [
    {
      "producto_id": 123,
      "nombre": "<string>"
    }
  ]
}

Authentication

Admin only - This endpoint requires admin authentication. Include an Authorization header with a valid admin bearer token:
Authorization: Bearer YOUR_ADMIN_TOKEN

Path Parameters

nombre
string
required
The current name of the category to update

Request Body

nombre
string
required
The new name for the category
slug
string
required
The new URL-friendly identifier for the category

Request Example

{
  "nombre": "Consumer Electronics",
  "slug": "consumer-electronics"
}

Response

Returns the updated category object.
categoria_id
long
Unique identifier for the category
nombre
string
Updated category name
slug
string
Updated URL-friendly category identifier
productos
array
List of products in this category

Response Example

{
  "categoria_id": 1,
  "nombre": "Consumer Electronics",
  "slug": "consumer-electronics",
  "productos": [
    {
      "producto_id": 101,
      "nombre": "Laptop"
    },
    {
      "producto_id": 102,
      "nombre": "Smartphone"
    }
  ]
}

cURL Example

curl -X PUT https://api.iquea.com/api/categorias/Electronics \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
  -d '{
    "nombre": "Consumer Electronics",
    "slug": "consumer-electronics"
  }'

Status Codes

200
OK
Category successfully updated
401
Unauthorized
Missing or invalid authentication token
403
Forbidden
User does not have admin permissions
404
Not Found
Category with the specified name does not exist
400
Bad Request
Invalid request body or missing required fields

Build docs developers (and LLMs) love