Overview
Updates an existing category’s information. The category is identified by its name in the URL path.Authentication
This endpoint requires:- Valid JWT token in the
Authorizationheader - User must have ADMIN role
Request
The current name of the category to update. This is used as the route parameter.
Request Body
The new name for the category.
- Required: Yes
- Type: String
- Max Length: 255 characters
The new description for the category.
- Required: No
- Type: String
- Max Length: 255 characters
Validation Rules
name: Required, string, maximum 255 charactersdescription: Optional (nullable), string, maximum 255 characters
Response
Indicates if the request was successful
Success message indicating the category was updated
The updated category object
Unique identifier for the category
Updated category name (max 255 characters)
Updated category description (max 255 characters)
Timestamp when the category was created
Timestamp when the category was last updated (reflects current update)
Timestamp when the category was soft deleted (null if active)
Code Examples
Response Examples
Success Response (200 OK)
Validation Error Response (422 Unprocessable Entity)
Returned when validation fails:Not Found Response (404 Not Found)
Returned when the category with the specified name does not exist:Unauthorized Response (401 Unauthorized)
Forbidden Response (403 Forbidden)
Returned when the authenticated user does not have ADMIN role:Error Codes
| Status Code | Description |
|---|---|
| 200 | Success - Category updated |
| 401 | Unauthorized - Invalid or missing JWT token |
| 403 | Forbidden - User does not have ADMIN role |
| 404 | Not Found - Category does not exist |
| 422 | Validation Error - Invalid input data |
| 500 | Internal Server Error |
Notes
- The category is identified by its name in the URL path
- The request body can include a new name to rename the category
- Both
nameanddescriptionfields are validated on update - The
updated_attimestamp will be automatically updated to reflect the current time