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
- items
-
Type:
array
itemsAdditional Properties Allowed:Variants of the product.
Nested Schema : items
Nested Schema : items
Type:
object
- mapKeyPropertyAttribute
-
Type:
string
specifies the key for optionValueMap in backing map. - optionName
-
Type:
string
Variant name - optionValueMap
-
Type:
object
optionValueMapAdditional Properties Allowed:Variant option information.
Nested Schema : optionValueMap
Type:
object
Variant option information.
- items
-
Type:
array
itemsAdditional Properties Allowed:Variant value map.
Nested Schema : items
Nested Schema : items
Type:
object
- Variant value
-
Type:
string
Variant 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:
string
An optional non-localized message containing technical information for developers - errorCode
-
Type:
string
The numerical code identifying the error - errors
-
Type:
array
errorsAdditional Properties Allowed:An optional list of errors if multiple errors were encountered - message
-
Type:
string
The localized message describing the error - moreInfo
-
Type:
string
An optional non-localized message with more information - o:errorPath
-
Type:
string
An optional machine readable description of where the error occurred - status
-
Type:
string
The HTTP status code - type
-
Type:
string
The URI to the HTTP state code definition
Nested Schema : errors
Nested Schema : items
Type:
object
- devMessage
-
Type:
string
An optional non-localized message containing technical information for developers - errorCode
-
Type:
string
The numerical code identifying the error - message
-
Type:
string
The localized message describing the error - moreInfo
-
Type:
string
An optional non-localized message with more information - o:errorPath
-
Type:
string
An optional machine readable description of where the error occurred - status
-
Type:
string
The 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" } ]