Skip to main content

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​

ParameterTypeDescription
idStringRequired. The ID of the product group.

Request Body​

Send the rule type and at least one list of IDs.

FieldTypeRequiredDescription
typeStringYesinclude or exclude.
companiesArrayNoIDs of companies. Up to 500 unique IDs.
companyGroupsArrayNoIDs of company groups. Up to 500 unique IDs.
customersArrayNoIDs 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​

FieldTypeDescription
successBooleanWhether the request succeeded.
messageStringResult message.
dataObjectNumber of companies, company groups and customers updated.

Notes​

  • include lets the target see the group's products, even if the group has restrictAccess or hiddenFrom set. exclude hides 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 productGroups field when you update a company, update a company group or update a customer.