Description
This endpoint retrieves a single category by its unique identifier. If the category with the specified ID does not exist, a 404 error is returned.
Path Parameters
The unique identifier of the category to retrieve
Response
Returns a single category object.
Unique identifier for the category
The category name (unique across all categories)
HTTP Status Codes
Successfully retrieved the category
Category with the specified ID was not found
An error occurred while processing the request
Example Request
curl -X GET http://localhost:8080/categories/1 \
-H "Content-Type: application/json"
Example Response
Success (200 OK)
{
"id": 1,
"name": "Electronics"
}
Error (404 Not Found)
{
"timestamp": "2026-03-03T10:15:30.000+00:00",
"status": 404,
"error": "Not Found",
"message": "Could not find category with id 1",
"path": "/categories/1"
}