Get All Product Groups
Retrieves all product groups, one page at a time. Each group includes its product count and a page of its products.
HTTP Request
- URL:
/productGroup/all - Method:
GET - Headers:
accessToken: Required. Your API access token.
- Required scope:
READ_PRODUCTGROUPorREAD_WRITE_PRODUCTGROUP
Query Parameters
| Parameter | Type | Description |
|---|---|---|
page | Integer | Page of product groups to return. Default is 1. |
limit | Integer | Number of product groups per page. Default is 10. |
search | String | Filter product groups by name. |
productPage | Integer | Page of products to return within each group. Default is 1. |
productLimit | Integer | Number of products to return per group. Default is 5. |
productSearch | String | Filter the products in each group by name or SKU. |
cURL Example
curl --location '<BASE_URL>/productGroup/all?page=1&limit=10&productLimit=3&search=power' \
--header 'accessToken: <ACCESS_TOKEN>'
Response
- 200 OK: The product groups were returned successfully.
- 400 Bad Request: The access token is missing or invalid, or does not have the required scope.
Sample JSON Response
{
"success": true,
"data": [
{
"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"
}
],
"productCount": 25,
"productPagination": {
"page": 1,
"total": 25,
"count": 1,
"limit": 3
}
}
],
"pagination": {
"page": 1,
"total": 1,
"count": 1,
"limit": 10
}
}
Response Details
Product Group Data
| Field | Type | Description |
|---|---|---|
id | String | Unique identifier of the product group. |
name | String | Name of the product group. |
status | Boolean | Whether the product group is active. Default is false. |
restrictAccess | Boolean | Whether the group's products are hidden from shoppers who are not given access. Default is false. |
hiddenFrom | Array | Shopper types the group's products are hidden from: guest, b2c. Default is []. |
products | Array | A page of the group's products. See Get Product. |
productCount | Number | Number of products in the group (or matching productSearch). |
productPagination | Object | Pagination details for products. |
createdAt | String | Date and time the group was created (ISO 8601). |
updatedAt | String | Date and time the group was last updated (ISO 8601). |
Pagination Details
| Field | Type | Description |
|---|---|---|
page | Number | Current page number. |
total | Number | Total number of product groups. |
count | Number | Number of product groups on this page. |
limit | Number | Number of product groups per page. |
Notes
- Products in the sample response are shortened. Each product contains all product fields.
guestmeans shoppers who are not signed in.b2cmeans signed-in customers who don't belong to a company.