Assign Product Group Rules
Gives specific companies, company groups or customers access to a product group (include), or hides the group from them (exclude).
HTTP Request
- URL:
/productGroup/{id}/rules - Method:
POST - Headers:
accessToken: Required. Your API access token.Content-Type:application/json
- Required scope:
READ_WRITE_PRODUCTGROUP
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | String | Required. The ID of the product group. |
Request Body
Send the rule type and at least one list of IDs.
| Field | Type | Required | Description |
|---|---|---|---|
type | String | Yes | include or exclude. |
companies | Array | No | IDs of companies. Up to 500 unique IDs. |
companyGroups | Array | No | IDs of company groups. Up to 500 unique IDs. |
customers | Array | No | IDs of customers. Up to 500 unique IDs. |
cURL Example
curl --location '<BASE_URL>/productGroup/66d220c8f57178681728212e/rules' \
--header 'accessToken: <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"type": "include",
"companies": ["6650b1c2d3e4f5a6b7c8d9e0", "6650b1c2d3e4f5a6b7c8d9e2"],
"customers": ["6652aa10bb20cc30dd40ee50"]
}'
Response
- 200 OK: The rules were saved successfully.
- 400 Bad Request: The access token is missing or invalid, the request body is not valid, or a company, company group or customer was not found.
- 404 Not Found: No product group matches the ID.
Sample JSON Response
{
"success": true,
"message": "Product group rule set to include",
"data": {
"companies": 2,
"customers": 1
}
}
Response Details
| Field | Type | Description |
|---|---|---|
success | Boolean | Whether the request succeeded. |
message | String | Result message. |
data | Object | Number of companies, company groups and customers updated. |
Notes
includelets the target see the group's products, even if the group hasrestrictAccessorhiddenFromset.excludehides the group's products from the target.- A new rule replaces any rule the target already has for this product group.
- A customer's rule takes priority over their company's rule, and a company's rule takes priority over its company group's rule.
- If any ID is not found, no rules are saved.
- You can also set rules through the
productGroupsfield when you update a company, update a company group or update a customer.