Skip to main content
DELETE
/
api
/
management
/
categories
/
{id}
Delete Category
curl --request DELETE \
  --url https://api.example.com/api/management/categories/{id}
{
  "success": true,
  "timestamp": "<string>",
  "data": null,
  "message": "<string>",
  "error": {}
}

Endpoint

DELETE /api/management/categories/{id}

Authentication

Required: ADMIN role This endpoint requires authentication with an admin user account. Include a valid JWT token in the Authorization header.

Request Headers

Authorization: Bearer <token>

Path Parameters

id
long
required
The unique identifier of the category to delete

Response

success
boolean
required
Indicates if the request was successful
timestamp
string
required
ISO 8601 timestamp of the response
data
null
Always null for delete operations
message
string
required
Success message: “Category deleted successfully”
error
object
Error details (null on success)

Example Request

curl -X DELETE "http://localhost:8080/api/management/categories/1" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Example Response

Success (200 OK)

{
  "success": true,
  "timestamp": "2026-03-03T10:30:00Z",
  "data": null,
  "message": "Category deleted successfully",
  "error": null
}

Error - Category Not Found (404)

{
  "success": false,
  "timestamp": "2026-03-03T10:30:00Z",
  "data": null,
  "message": null,
  "error": {
    "message": "Category not found with id: 999",
    "details": []
  }
}

Error - Unauthorized (401)

{
  "success": false,
  "timestamp": "2026-03-03T10:30:00Z",
  "data": null,
  "message": null,
  "error": {
    "message": "Unauthorized",
    "details": []
  }
}

Error - Forbidden (403)

{
  "success": false,
  "timestamp": "2026-03-03T10:30:00Z",
  "data": null,
  "message": null,
  "error": {
    "message": "Access denied. ADMIN role required.",
    "details": []
  }
}

Error - Category In Use (409)

{
  "success": false,
  "timestamp": "2026-03-03T10:30:00Z",
  "data": null,
  "message": null,
  "error": {
    "message": "Cannot delete category as it is associated with existing books",
    "details": []
  }
}

Important Notes

  • Deleting a category may fail if it is currently associated with books in the system
  • This operation is irreversible
  • Consider the impact on related entities before deletion

Source Code Reference

Controller: apps/spring-boot-app/src/main/java/me/seyrek/library_management_system/category/controller/CategoryManagementController.java:34

Build docs developers (and LLMs) love