Get Product Group
The GET endpoint retrieves details of a specific product group specified by the productGroup_id, including all associated products with pagination support.
Endpoint
- URL:
/open-api/api/productGroup/{productGroup_id} - Method:
GET
Authentication
- Header:
accessToken - Type: Bearer Token
- Value:
<ACCESS-TOKEN>
Path Parameters
| Parameter | Type | Description |
|---|---|---|
productGroup_id | string | The unique identifier of the product group to retrieve. |
Query Parameters
| Parameter | Type | Description | Default |
|---|---|---|---|
page | number | Page number for product pagination | 1 |
limit | number | Number of products per page (max 50) | 10 |
search | string | Search products by name or SKU within group | - |
Request Headers
| Header | Type | Description |
|---|---|---|
accessToken | string | Access token for authentication. (required) |
Response
- Status Code: 200 OK
Response Fields
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates whether the request was successful |
data | object | Contains product group details and associated products |
data.productGroup | object | Product group information |
data.products | array | Array of products in the group |
data.pagination | object | Pagination information for products |
Sample Response Body
{
"success": true,
"data": {
"productGroup": {
"id": "66d220c8f57178681728212e",
"name": "Electronics",
"status": true,
"restrictAccess": false,
"createdAt": "2024-08-30T19:43:04.216Z",
"updatedAt": "2024-08-31T18:18:28.191Z"
},
"products": [
{
"id": "64f123abc456789012345679",
"name": "iPhone 15",
"sku": "IPH15-001",
"price": 999,
"status": "active",
"description": "Latest iPhone model",
"variants": [
{
"id": "64f123abc456789012345680",
"sku": "IPH15-128GB-BLACK",
"name": "iPhone 15 128GB Black",
"price": 999,
"cost": 750,
"sale": 899,
"options": [
{
"optionName": "Storage",
"optionValueLabel": "128GB",
"optionValue": "128gb"
},
{
"optionName": "Color",
"optionValueLabel": "Black",
"optionValue": "black"
}
],
"inventory": {
"stock": 50,
"minStock": 10
},
"isActive": true
}
],
"categories": ["electronics", "phones"],
"mediaGallery": [...],
"seo": {...}
}
],
"pagination": {
"page": 1,
"total": 25,
"count": 10,
"limit": 10
}
}
}
Error Responses
| Status Code | Description |
|---|---|
| 401 | Unauthorized: Access token is invalid or missing. |
| 404 | Not Found: The specified product group could not be found. |
| 500 | Internal Server Error: An error occurred on the server. |
Notes
- Product Data: The response now includes complete product information with all fields including variants, categories, media gallery, SEO data, and metadata.
- Pagination: Products within the group are paginated. Use
pageandlimitparameters to navigate through products. - Search: Use the
searchparameter to filter products by name or SKU within the group. - ID Conversion: All
_idfields are automatically converted toidin the response. - Ensure you include a valid
accessTokenin the request to authenticate. - Maximum
limitis 50 products per page to prevent performance issues.
Success Response Body
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates the [#success_status][success_status] of the request, typically true for success. |
data | object | Contains details of the product group. |
Data Object
| Field | Type | Description |
|---|---|---|
id | string | The unique identifier of the product group. |
name | string | The name of the product group. |
status | boolean | The status of the product group (e.g., active or inactive). |
createdAt | string | The timestamp indicating when the product group was created. |
updatedAt | string | The timestamp indicating the last update time of the product group. |
Error Responses
| Status Code | Description |
|---|---|
| 400 | Bad Request: Invalid input data. |
| 401 | Unauthorized: Access token is invalid or missing. |
| 404 | Not Found: The specified product group could not be found. |
| 500 | Internal Server Error: An error occurred on the server. |
Notes
- Ensure you replace
{productGroup_id}in the URL with the actual unique identifier of the product group being retrieved. - Provide a valid and active access token in the request header to authenticate your request.