Get Category By ID
Get a specific category by its ID with its hierarchical structure.
Endpoint
Authentication
Not required (public endpoint)
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
integer | Yes | Category ID |
Response
Success (200 OK)
Returns the category in a hierarchical tree structure:
[
{
"id": 1,
"name": "Electronics",
"image": "https://...",
"parent_id": null,
"children": [
{
"id": 2,
"name": "Laptops",
"image": "https://...",
"parent_id": 1,
"children": []
}
]
}
]
Error Responses
Category Not Found (404)
Example Request
Notes
- Returns category with its parent and children in tree structure
- Only returns non-deleted categories