Product recommendations response
Describes the product recommendations received in a response, generated by the Optimizely recommendations engine.
The Optimizely Recommendations API returns a list of product recommendations in the message.
The contents are returned in the smartRecs
element at the root of the response JSON. It contains the product recommendations generated by the Optimizely recommendations engine. These product recommendations are grouped by widget.
The value of smartRecs
is a list of product recommendation widget elements. These elements have the following properties:
Parameters | Description and usage | |||
---|---|---|---|---|
campaignId | [String] The ID of the widget campaign. This is used for validation.
|
|||
campaignName | [String] The name of the widget campaign. This is used for validation.
|
|||
widgets | [List] The list of widgets in the campaign.
|
|||
widgetId | [String] The ID of the widget.
|
|||
widgetName | [String] The name of the widget.
|
|||
alias | [String] The alias name of the widget. Multiple widgets can share the same alias.
|
|||
recs | A list of product recommendations.
|
|||
img | [String] URL of the product image.
|
|||
title | [String] Product title.
|
|||
url | [String] URL to the product page for the item.
|
|||
refCode | [String] Product reference code.
|
|||
prices | A map in which the key will be the currency name (such as USD, GBP, and so on) and the value a map with unitPrice and salePrice properties. For example:
|
|||
unitPrice | [Number] The price per unit of the item. |
|||
salePrice | [Number] The sale price of the item. |
|||
attributes | A list of attributes and their values. Attributes required in the request.
|
In the request, you can configure the output details of the recommended product by the recContent
request parameter.
Response examples
The following example shows three product recommendations returned for one widget with full product details, which is the default behavior when recContent
is omitted or has value full:
{
"status" : "OK",
"smartRecs" : [{
"campaignId" : "k3Rw892i",
"campaignName" : "Packaging slip",
"widgets" : {
"widgetId" : "08Ppq3ca",
"widgetName" : "middlejson",
"alias" : "Packaging slip (4 recs)",
"recs" : [{
"img" : "http://www.retailer.com/img/RC678_size_small",
"title" : "Levis Washed Jeans"
"url" : "http://www.retailer.com/product/RC678.html",
"refCode" : "RC678",
"prices" : {
"GBP" : {
"unitPrice" : 52.00,
"salePrice" : 40.00
}
},
"attributes" : {
"colour" : "dirty blue"
}
},
{
"img" : "http://www.retailer.com/img/RC910_size_small",
"title" : "Levis Dirty Jeans",
"url" : "http://www.retailer.com/product/RC910.html",
"refCode" : "RC910",
"prices" : {
"GBP" : {
"unitPrice" : 54.95,
"salePrice" : 43.95
}
},
"attributes" : {
"colour" : "washed blue"
}
},
{
"img" : "http://www.retailer.com/img/RC101_size_small",
"title" : "Levis Legless Jeans",
"url" : "http://www.retailer.com/product/RC101.html",
"refCode" : "RC101",
"prices" : {
"GBP" : {
"unitPrice" : 39.95,
"salePrice" : 39.95
}
},
"attributes" : {
"colour" : "just blue"
}
}]
}
}],
}
This is the returned result when recContent
property is set to refCodeOnly
:
{
"status" : "OK",
"smartRecs" : [
{
"campaignId" : "k3Rw892i",
"campaignName" : "Packaging slip",
"widgets" : {
"widgetId" : "08Ppq3ca",
"widgetName" : "middlejson",
"alias" : "Packaging slip (4 recs)",
"recs" : [
{
"refCode" : "RC678",
"attributes" : {"colour" : "dirty blue"}
},
{
"refCode" : "RC910",
"attributes" : {"colour" : "washed blue"}
},
{
"refCode" : "RC101",
"attributes" : {"colour" : "just blue"}
}
]
}
}
],
}
Updated over 1 year ago