Product.setMasterGroups
The API call sends information about one or more groups to Shop. A group is a set of products linked to the same master template. The data contains one or more groups with an unique identifier and all the products' SKUs that currently belong to the respective group. A product is never supposed to change its group, so the API would be typically called only as a result of product being created in Shop.
Configuration
API call is executed if Master Groups feature is enabled SC > Maintenance > Configuration Parameters > mastergroupsenabled.
Request
JSON example:
[
{
"api":1,
"method":"auth",
"params":{
"username":"...",
"password":"..."
},
"id":1
},
{
"api":1,
"method":"Product.setMasterGroups",
"params":{
"masterGroupsInfo":[
{
"identifier":"identifier1",
"products":[
"NI564HLAL4HQANPH-670052"
]
},
{
"identifier":"identifier2",
"products":[
"AP816ELAULQ1ANPH-1190784"
]
}
]
},
"id":1
}
]
Request fields:
Field name |
Type |
Example value |
Description |
---|---|---|---|
method |
string |
"Product.setMasterGroups" |
Action name |
identifier |
string |
"78947-987984" |
Product master group Id |
products |
array |
["123-456", "789-123",…] |
SKUs of all the products that are currently in the group; the array may be empty |
Response
Response containing the master group setting status.
JSON example:
[
{
"api":1,
"result":[
{
"status":"failure",
"identifier":"886111713318",
"message":"Invalid SKU in group"
},
{
"status":"failure",
"identifier":"886111935796",
"message":"Invalid SKU in group"
},
{
"status":"failure",
"identifier":"725184712173",
"message":"Invalid SKU in group"
}
],
"id":1
}
]
Response fields:
Field |
Type |
Value |
Description |
---|---|---|---|
status |
string |
"failure" |
Request status:
|
identifier |
string |
"886111713318" |
Master group Id |
message |
string |
"Invalid SKU in group" |
Optional message can be filled in case of failure |