Skip to main content

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

ParameterTypeDescription
productGroup_idstringThe unique identifier of the product group to retrieve.

Query Parameters

ParameterTypeDescriptionDefault
pagenumberPage number for product pagination1
limitnumberNumber of products per page (max 50)10
searchstringSearch products by name or SKU within group-

Request Headers

HeaderTypeDescription
accessTokenstringAccess token for authentication. (required)

Response

  • Status Code: 200 OK

Response Fields

FieldTypeDescription
successbooleanIndicates whether the request was successful
dataobjectContains product group details and associated products
data.productGroupobjectProduct group information
data.productsarrayArray of products in the group
data.paginationobjectPagination 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 CodeDescription
401Unauthorized: Access token is invalid or missing.
404Not Found: The specified product group could not be found.
500Internal 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 page and limit parameters to navigate through products.
  • Search: Use the search parameter to filter products by name or SKU within the group.
  • ID Conversion: All _id fields are automatically converted to id in the response.
  • Ensure you include a valid accessToken in the request to authenticate.
  • Maximum limit is 50 products per page to prevent performance issues.

Success Response Body

FieldTypeDescription
successbooleanIndicates the [#success_status][success_status] of the request, typically true for success.
dataobjectContains details of the product group.

Data Object

FieldTypeDescription
idstringThe unique identifier of the product group.
namestringThe name of the product group.
statusbooleanThe status of the product group (e.g., active or inactive).
createdAtstringThe timestamp indicating when the product group was created.
updatedAtstringThe timestamp indicating the last update time of the product group.

Error Responses

Status CodeDescription
400Bad Request: Invalid input data.
401Unauthorized: Access token is invalid or missing.
404Not Found: The specified product group could not be found.
500Internal 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.