This endpoint updates an existing category by ID. Requires authentication and admin role.
Authentication
Bearer token for authentication. Must have admin role.
Path Parameters
The unique identifier of the category to update
Request Body
New name for the category (optional)
curl -X PUT https://api.example.com/categories/1 \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Consumer Electronics"
}'
Response
{
"id": "1",
"name": "Consumer Electronics",
"createdAt": "2024-01-15T10:30:00Z"
}
Response Fields
Unique identifier for the category
Updated name of the category
ISO 8601 timestamp of when the category was originally created
Error Responses
{
"message": "Unauthorized"
}