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

Endpoint

GET /api/categories/{id}

Authentication

No authentication required. This is a public endpoint.

Path Parameters

id
long
required
The unique identifier of the category to retrieve

Response

success
boolean
required
Indicates if the request was successful
timestamp
string
required
ISO 8601 timestamp of the response
data
object
required
The category object
id
long
required
Unique identifier for the category
name
string
required
Name of the category
message
string
Optional message
error
object
Error details (null on success)

Example Request

curl -X GET "http://localhost:8080/api/categories/1"

Example Response

Success (200 OK)

{
  "success": true,
  "timestamp": "2026-03-03T10:30:00Z",
  "data": {
    "id": 1,
    "name": "Fiction"
  },
  "message": null,
  "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": []
  }
}

Source Code Reference

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

Build docs developers (and LLMs) love