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:
stringRequired:trueproduct id- showInactiveSkus
Type:booleanReturn inactive skus only if its value is true
Header Parameters
- x-ccsite
-
Type:
stringthe 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
- items
-
Type:
arrayitemsAdditional Properties Allowed:Variants of the product.
Nested Schema : items
Nested Schema : items
Type:
object- mapKeyPropertyAttribute
-
Type:
stringspecifies the key for optionValueMap in backing map. - optionName
-
Type:
stringVariant name - optionValueMap
-
Type:
objectoptionValueMapAdditional Properties Allowed:Variant option information.
Nested Schema : optionValueMap
Type:
objectVariant option information.
- items
-
Type:
arrayitemsAdditional Properties Allowed:Variant value map.
Nested Schema : items
Nested Schema : items
Type:
object- Variant value
-
Type:
stringVariant value containing value and code (eg. 'black':0)
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- devMessage
-
Type:
stringAn optional non-localized message containing technical information for developers - errorCode
-
Type:
stringThe numerical code identifying the error - errors
-
Type:
arrayerrorsAdditional Properties Allowed:An optional list of errors if multiple errors were encountered - message
-
Type:
stringThe localized message describing the error - moreInfo
-
Type:
stringAn optional non-localized message with more information - o:errorPath
-
Type:
stringAn optional machine readable description of where the error occurred - status
-
Type:
stringThe HTTP status code - type
-
Type:
stringThe URI to the HTTP state code definition
Nested Schema : errors
Nested Schema : items
Type:
object- devMessage
-
Type:
stringAn optional non-localized message containing technical information for developers - errorCode
-
Type:
stringThe numerical code identifying the error - message
-
Type:
stringThe localized message describing the error - moreInfo
-
Type:
stringAn optional non-localized message with more information - o:errorPath
-
Type:
stringAn optional machine readable description of where the error occurred - status
-
Type:
stringThe HTTP status code
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"
}
]