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

Miva Developer Docs

Retrieves the list of variants for a product.


Retrieves the variants of a product, with each variant’s options and parts. Use Count and Offset to page through products that have many variants.

Before you begin#

  • The API token needs ProductVariantList_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 a product’s variants#

Returns up to 39 variants for the product.

{
    "Store_Code": "{{Store_Code}}",
    "Miva_Request_Timestamp": "{{$timestamp}}",
    "Function": "ProductVariantList_Load_Query",
    "Count": 39,
    "Filter": "",
    "Offset": 0,
    "Product_ID": "{{Product_ID}}"
}

Get the next page#

Returns the second page of 10 variants by setting Offset to 10.

{
    "Store_Code": "{{Store_Code}}",
    "Miva_Request_Timestamp": "{{$timestamp}}",
    "Function": "ProductVariantList_Load_Query",
    "Count": 10,
    "Offset": 10,
    "Product_ID": "{{Product_ID}}"
}

Request parameters#

Parameter Type Required Description
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.
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": 8,
    "start_offset": 0,
    "data": [
      {
        "offset": 0,
        "product_id": 1,
        "variant_id": 4,
        "option_id_9_1": 1,
        "option_code_9_1": "SM",
        "parts": [
          {
            "offset": 0,
            "product_id": 207,
            "product_code": "shirt_SM",
            "product_sku": "",
            "product_name": "Shirt size:SM",
            "quantity": 1
          }
        ]
      },
      ...
    ]
  }
}

Response parameters#

Parameter Type Description
success Boolean Boolean value indicating if the api request was successful
total_count Number The total number of product variants returned
start_offset Number The number of pages of results. Default 0 is no offset.
offset Number The number of pages of results. Default 0 is no offset.
product_id Number The product id
variant_id Number The id number of variant
option_id_9_1 Number The option id number of the variant
option_code_9_1 String The option id code of the variant
parts Object The product variant parts

Parts Object#

The product variant parts

Parameter Type Description
offset Number The number of pages of results. Default 0 is no offset.
product_id Number The product id of the variant
product_code String The product code of the variant
product_sku String The product sku of the variant
product_name String Product name of the variant
quantity Number The quantity of the variant

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 variants match. See Pagination.

Error responses#

Error Code Error Message Error Description
MER-JSN-PRD-00070 Product not found Product id is not found
Function Use it to
ProductVariantList_Load_Product Load the variants of a product
ProductVariant_Insert Create a product variant
ProductVariant_Update Change a product variant
ProductVariantPricing_Update Change a variant’s pricing
ProductVariantList_Delete Delete product variants

Try in Postman#

In the Miva: JSON API: Authenticated collection, open Products > ProductVariantList_Load_Query. See Set Up Postman.