Loading...
Area: Episerver Product Recommendations
Applies to versions: 1.0 and higher (Personalization API)

Product recommendations response

Recommendations [hide]

The Personalization 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 Episerver 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 Usage
campaignId The ID of the widget campaign.

[String] This is used for validation.

"campaignId" : "k3Rw892i"
campaignName The name of the widget campaign.

[String] This is used for validation.

"campaignName" : "Packaging slip"
widgets The list of widgets in the campaign.

[List]

"widgets" : [{…},{…},…]
  widgetId The ID of the widget.

[String]

"widgetId" : "08Ppq3ca"
  widgetName The name of the widget.

[String]

"widgetId" : "middlejson"
  alias The alias name of the widget. Multiple widgets can share the same alias.

[String]

"alias" : "Packaging slip (4 recs)"
  recs A list of product recommendations
"recs" : [{…},{…},{…},…]
    img URL of the product image

[String]

"img" : "http://www.retailer.com/img/RC678_size_small"
    title Product title

[String]

"title" : "Levis Washed Jeans"
    url URL to the product page for the item

[String]

"url" : "http://www.retailer.com/product/RC678.html"
    refCode Product reference code

[String]

"refCode" : "RC678"
    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:

"prices"  : {
              "GBP" : {
                        "unitPrice" : 52.00,
                        "salePrice" : 40.00
                      }
            }
      unitPrice The price per unit of the item [Number]
      salePrice The sale price of the item [Number]
    attributes A list of attributes and their values

Attributes required in the request.

"attributes" : { "colour" : "washed blue", … }

The output details of the recommended product can be configured in the request 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"}
                                                        }
                                                      ]
                                     }
                  }
                ],
}
Do you find this information helpful? Please log in to provide feedback.

Last updated: Nov 06, 2017

Recommendations [hide]