Get Category
This endpoint retrieves detailed information about a specific category using its unique ID.
Endpoint
- URL:
/categories/{id} - Method:
GET
Replace {id} with the specific category ID you want to retrieve.
Authentication
- Header:
accessToken - Type: Bearer Token
- Value:
<ACCESS-TOKEN>
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The unique identifier of the category to retrieve. |
Request Headers
| Header | Type | Description |
|---|---|---|
accessToken | string | Access token for authentication. (required) |
Sample Request
curl --location '<BASE-URL>/categories/66acedf2bf8641f96544253b' \
--header 'accessToken: <ACCESS-TOKEN>'
Response
- Status Code: 200 OK
Sample Response Body
{
"success": true,
"data": {
"createdAt": "2024-08-02T14:32:18.344Z",
"hasChildren": false,
"hasParent": false,
"isShow": false,
"metaFields": [],
"name": "Materials",
"parentCategory": null,
"path": "66acedf2bf8641f96544253b",
"productCount": 0,
"sortOrder": 0,
"updatedAt": "2024-10-09T13:05:59.036Z",
"url": "materials.html",
"id": "66acedf2bf8641f96544253b"
}
}
Response Fields
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates whether the request was successful. |
data | object | Contains detailed information about the category. |
Category Object
| Field | Type | Description |
|---|---|---|
createdAt | string | Timestamp when the category was created (ISO 8601 format). |
hasChildren | boolean | Indicates if the category has children. |
hasParent | boolean | Indicates if the category has a parent. |
isShow | boolean | Flag indicating if the category is visible. |
metaFields | array | List of additional metadata fields, currently empty. |
name | string | Name of the category. |
parentCategory | string? | ID of the parent category, if applicable. |
path | string | The hierarchical path representation of the category. |
productCount | number | Number of products in the category. |
sortOrder | number | Order for sorting categories. |
updatedAt | string | Timestamp when the category was last updated (ISO 8601 format). |
url | string | URL path segment for the category. |
id | string | Unique identifier of the category. |
Notes
- Ensure the
accessTokenis valid and included in the request header for authentication. - This endpoint retrieves detailed information for a single category based on the provided ID.