Get Product Group
Retrieves a single product group and a page of the products assigned to it.
HTTP Request
- URL:
/productGroup/{id} - Method:
GET - Headers:
accessToken: Required. Your API access token.
- Required scope:
READ_PRODUCTGROUPorREAD_WRITE_PRODUCTGROUP
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | String | Required. The ID of the product group to retrieve. |
Query Parameters
| Parameter | Type | Description |
|---|---|---|
page | Integer | Page of products to return. Default is 1. |
limit | Integer | Number of products per page. Default is 10. |
search | String | Filter the group's products by name or SKU. |
cURL Example
curl --location '<BASE_URL>/productGroup/66d220c8f57178681728212e?page=1&limit=10' \
--header 'accessToken: <ACCESS_TOKEN>'
Response
- 200 OK: The product group was returned successfully.
- 400 Bad Request: The access token is missing or invalid, or the product group ID is not valid.
- 404 Not Found: No product group matches the ID.
Sample JSON Response
{
"success": true,
"data": {
"productGroup": {
"id": "66d220c8f57178681728212e",
"name": "Power Tools",
"status": true,
"restrictAccess": false,
"hiddenFrom": ["guest"],
"createdAt": "2024-08-30T19:43:04.216Z",
"updatedAt": "2024-08-31T18:18:28.191Z"
},
"products": [
{
"_id": "64f123abc456789012345679",
"name": "Cordless Drill 18V",
"sku": "CD-18V-001",
"price": 129.99,
"status": "active",
"productGroups": ["66d220c8f57178681728212e"],
"id": "64f123abc456789012345679"
}
],
"pagination": {
"page": 1,
"total": 25,
"count": 10,
"limit": 10
}
}
}
Response Details
Data Object
| Field | Type | Description |
|---|---|---|
productGroup | Object | The product group. See Get All Product Groups. |
products | Array | A page of the group's products. See Get Product. |
pagination | Object | Pagination details for products. See below. |
Pagination Details
| Field | Type | Description |
|---|---|---|
page | Number | Current page number. |
total | Number | Total number of matching products. |
count | Number | Number of products on this page. |
limit | Number | Number of products per page. |
Notes
- Products in the sample response are shortened. Each product contains all product fields.