Assigns a related product to a product, or removes the assignment. Set Assigned to true to assign it and false to remove it.
Before you begin#
- The API token needs
RelatedProduct_Update_Assigned, either assigned directly under Functions or through a group. See Create an API token. - Requests must be signed if the token requires it. See Make a signed request with HMAC.
- You need the ID, code or SKU of the product, and the ID or code of the related product.
Example requests#
Assign a related product#
Assigns the related product to the product.
{
"Store_Code": "{{Store_Code}}",
"Miva_Request_Timestamp": "{{$timestamp}}",
"Function": "RelatedProduct_Update_Assigned",
"Product_Code": "{{Product_Code}}",
"RelatedProduct_Code": "{{Product_Code}}",
"Assigned": true
}
Request parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
function |
String | Yes | Related Product Update Assigned |
product_idEdit_ProductProduct_CodeProduct_SKU |
Number String String String |
ID Number of product Product code string Product code string Product SKU string |
|
relatedproduct_idEdit_relatedproductrelatedproduct_Code |
Number String String |
ID Number of Related Product Related Product code string Related Product code string |
|
assigned |
Boolean | Yes | Boolean value indicating if the related product should be assigned to the product |
Example response#
{
"success": 1
}
Response parameters#
| Parameter | Type | Description |
|---|---|---|
success |
Boolean | Boolean value indicating if the API request was successful |
Related functions#
| Function | Use it to |
|---|---|
RelatedProductList_Load_Query |
Load a product’s assigned and unassigned related products |
Runtime_RelatedProductList_Load_Query |
Load related products from the storefront |
ProductList_Load_Query |
Find products, including their related products |
Product_Update |
Change a product |
Try in Postman#
In the Miva: JSON API: Authenticated collection, open Products > RelatedProduct_Update_Assigned. See Set Up Postman.