listProductVariants

get

/ccagent/v1/variants

List Product Variants. Returns a list of variants available for a given Product. A similar endpoint exists for Storefront, that is not implemented currently. Takes X-CCAgentContext header which is a JSON object with 'shopperProfileId' as a property. If 'shopperProfileId' is not provided, it is considered as an anonymous profile.Additonally takes x-ccsite header to return the data specific to the site.

Request

Supported Media Types
  • application/json
Query Parameters
productId
Type: string
Required: true
product id
showInactiveSkus
Type: boolean
Return inactive skus only if its value is true
Header Parameters
x-ccsite
Type: string
the site id on which the orders is laced

Response

Supported Media Types
  • application/json
200 Response
Following model is returned when operation succeeds.
Body
Root Schema : listProductVariants_response
Nested Schema : items
Type: array
Variants of the product.
Nested Schema : items
Type: object
Nested Schema : optionValueMap
Type: object
Variant option information.
Nested Schema : items
Type: array
Variant value map.
Nested Schema : items
Type: object
Example application/json

[
    {
        "optionValueMap":{
            "Silver":1,
            "Neon":2,
            "Black":0
        },
        "mapKeyPropertyAttribute":"sku-camcorder_color",
        "optionName":"color"
    },
    {
        "optionValueMap":{
            "27x optical/320x digital":4,
            "20x optical/320x digital":3,
            "2x optical/130x digital":0
        },
        "mapKeyPropertyAttribute":"sku-camcorder_zoom",
        "optionName":"zoom"
    }
]
Default Response
The error response. The following are the internal error codes thrown by this API when the request processing fails in Oracle Commerce Cloud: |Error Code|Description| |------------------|------------------| |30015|SiteId passed in x-ccsite header is currently inactive| |30014|SiteId passed in x-ccsite header is invalid or the site was deleted| |20032|Product Id passed is null or empty| |20031|Product Id '12' is invalid or non-existent|
Body
Root Schema : errorModel
Type: object
Nested Schema : errors
Type: array
An optional list of errors if multiple errors were encountered
Nested Schema : items
Type: object

Examples

Sample Response Payload returned by endpoint:

[
  {
    "optionValueMap": {
      "Silver": 1,
      "Neon": 2,
      "Black": 0
    },
    "mapKeyPropertyAttribute": "sku-camcorder_color",
    "optionName": "color"
  },
  {
    "optionValueMap": {
      "27x optical/320x digital": 4,
      "20x optical/320x digital": 3,
      "2x optical/130x digital": 0
    },
    "mapKeyPropertyAttribute": "sku-camcorder_zoom",
    "optionName": "zoom"
  }
]