Created by potrace 1.16, written by Peter Selinger 2001-2019

Miva Developer Docs

Retrieves the related products for a product.


Retrieves the related products for a product. Use Assigned and Unassigned to choose whether you get the products already assigned, the ones that aren’t, or both. Each record’s assigned flag tells you which it is.

Before you begin#

  • The API token needs RelatedProductList_Load_Query, 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 product’s Product_ID, Edit_Product, Product_Code or Product_SKU.

Example requests#

Retrieve assigned and unassigned products#

Returns up to 42 products, both assigned and unassigned, sorted by display order.

{
    "Store_Code": "{{Store_Code}}",
    "Miva_Request_Timestamp": "{{$timestamp}}",
    "Function": "RelatedProductList_Load_Query",
    "Assigned": true,
    "Count": 42,
    "Filter": "",
    "Offset": 0,
    "Product_ID": "{{Product_ID}}",
    "Sort": "disp_order",
    "Unassigned": true
}

Sets Unassigned to false so the response has only the products already assigned.

{
    "Store_Code": "{{Store_Code}}",
    "Miva_Request_Timestamp": "{{$timestamp}}",
    "Function": "RelatedProductList_Load_Query",
    "Product_ID": "{{Product_ID}}",
    "Assigned": true,
    "Unassigned": false,
    "Count": 10,
    "Offset": 0,
    "Sort": "disp_order"
}

Request parameters#

Parameter Type Required Description
assigned Boolean No Boolean value indicating if the query returns currently assigned related products
unassigned Boolean No Boolean value indicating if the query returns unassigned related products
count Number No Maximum lines of data allowed to be returned in the response. This limit is used to prevent excessive amounts of data return
filter String No A string for filtering returned data
offset Number No Used with the Count parameter for paginating results of large datasets. Default 0 is no offset.
sort String No The order for sorting returned data
product_id
Edit_Product
Product_Code
Product_SKU
Number
String
String
String
ID Number of product
Product code string
Product code string
Product SKU string

Example response#

{
    "success": 1,
    "data": {
        "total_count": 214,
        "start_offset": 0,
        "data": [
            {
                "assigned": false,
                "id": 2,
                "code": "59535-4601",
                "sku": "53208-377",
                "name": "Pastry - Key Limepoppy Seed Tea",
                "thumbnail": "",
                "image": "",
                "price": 20.45,
                "formatted_price": "$20.45",
                "cost": 74.11,
                "formatted_cost": "$74.11",
                "weight": 10.0,
                "taxable": true,
                "active": true,
                "page_title": "",
                "dt_created": 1623690274,
                "dt_Updated": 1623690274
            },
            {
                "assigned": false,
                "id": 3,
                "code": "60232-2283",
                "sku": "55910-397",
                "name": "White Baguette",
                "thumbnail": "",
                "image": "",
                "price": 195.65,
                "formatted_price": "$195.65",
                "cost": 135.52,
                "formatted_cost": "$135.52",
                "weight": 5.0,
                "taxable": true,
                "active": true,
                "page_title": "",
                "dt_created": 1623690274,
                "dt_Updated": 1631638720
            }
        ]
    }
}

Response parameters#

Parameter Type Description
success Boolean Boolean value indicating if the API request was successful
total_count Number The number of related products returned
start_offset Number The offset starting point for pagination of return data
assigned Boolean Boolean value indicating if the related product is currently assigned to the product
id Number The related product id
code String The related product code
sku String The related product sku
name String The related product name
thumbnail String The filepath for the related product thumbnail
image String The filepath for the related product image
price Number The price of the related product
formatted_price String Currency formatted price of the related product
cost Number The related product cost
formatted_cost String Currency formatted related product cost
weight Number The related product weight
taxable Boolean Boolean value indicating if the related product is taxable
active Boolean Boolean value indicating if the related product is active
page_title String The title of the related product page
dt_created Number Unix timestamp for the related product creation date
dt_Updated Number Unix timestamp for the related product’s most recent update

Additional options#

List Load Query overview explains the filter format and every operator.

Pagination#

Count and Offset page through results, and the response’s total_count says how many products match. See Pagination.

Function Use it to
RelatedProduct_Update_Assigned Assign or unassign a related product
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 > RelatedProductList_Load_Query. See Set Up Postman.