Overview
Deletes a category from the system. This performs a soft delete, marking the category with adeleted_at timestamp rather than permanently removing it from the database.
Authentication
This endpoint requires:- Valid JWT token in the
Authorizationheader - User must have ADMIN role
Request
The name of the category to delete. This is used as the route parameter.
Response
Indicates if the request was successful
Success message indicating the category was deleted
Code Examples
Response Examples
Success Response (200 OK)
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 deleted |
| 401 | Unauthorized - Invalid or missing JWT token |
| 403 | Forbidden - User does not have ADMIN role |
| 404 | Not Found - Category does not exist |
| 500 | Internal Server Error |
Notes
- This endpoint performs a soft delete. The category record is not permanently removed from the database
- Instead, the
deleted_attimestamp is set to the current time - Soft-deleted categories can potentially be restored by database administrators
- Associated subcategories and articles may be affected by the deletion
- Consider checking for dependencies before deleting a category that may be in use