Pages

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from this space and version 14.5

...

Code Block
languagejs
themeRDark
titleResponse structure with debugging information
{
  "data": [
    {<item 1 data>},
    {<item 2 data>},
    ...
    {<item n data>}
  ],
  "debug": [
    <debugging information>
  ]
}

If there's no recommendation data available for the requested strategy, the API returns an empty array.

Code Block
languagejs
themeRDark
{
  "data": []
}

Examples

The following two examples show the same response without and with debugging information.

Code Block
languagejs
themeRDark
titleExample: Recommendation data in a responseResponse with recommendation data only
collapsetrue
{
  "data": [
    {
      "id": "35",
      "type": "Power Tools/DrillsWoodworking",
      "name": "DrillBrandix ScrewdriverRouter BrandixPower ALX7054Tool 200 Watts2017ERXPK",
      "created_at": "2020-0912-10T1323T10:5004:4139+02:00",
      "updated_at": "2021-0610-09T1326T10:2214:0900+0203:00",
      "attributes": {
        "availabilitybrand": "In stockWakita",
        "badgescategory": [

        ]"Power Tools/Woodworking",
        "brandimage": "Wakita",
        "category": "Power Tools/Drillshttps://demo-retail-bp.docker-box.inpref.com/images/products/product-5.jpg",
        "deliverTime": 1,
        "discountPricemanufacturer": "0Wakita",
        "displayDiscountPriceprice": null,
        "displayPrice": "€8501700.00",
        "imageurl": "https://demo-retail-bp.docker-box.inpref.com/imagesshop/products/product-3.jpg",
product/5"
      }
   "manufacturer": "Wakita" },
    {
      "priceid": 850"1",
        "ratingtype": 4"Power Tools/Woodworking",
      "name": "Electric Planer Brandix KL370090G 300 "reviewsWatts": 8,
        "stockcreated_at": 9"2020-11-09T15:51:53+02:00",
        "urlupdated_at": "https://demo-retail-bp.docker-box.inpref.com/shop/product/3"2021-10-15T16:39:37+03:00",
      }
    },
    {
"attributes": {
        "idbrand": "4Wakita",
        "typecategory": "Power Tools/DrillsWoodworking",
        "nameimage": "Drill Series 3 Brandix KSR4590PQS 1500 Watts",
https://demo-retail-bp.docker-box.inpref.com/images/products/product-1.jpg",
        "created_atmanufacturer": "2020-09-10T14:38:37+02:00Wakita",
        "updated_atprice": "2021-06-09T13:22:10+02:00",
509.32,
        "attributesurl": {"https://demo-retail-bp.docker-box.inpref.com/shop/product/1"
      }
  "availability": "In stock"},
    {
      "badgesid": ["20",

        ]"type": "Makeup/Makeup Products",
        "brandname": "WakitaLipstick, Red Perky",
        "categorycreated_at": "Power Tools/Drills2020-11-03T13:23:59+02:00",
        "deliverTimeupdated_at": 3"2021-10-06T15:32:26+03:00",
        "discountPriceattributes": "0",{
        "displayDiscountPricebrand": null"Tiks",
        "displayPricecategory": "€949.00Makeup/Makeup Products",
        "image": "https://demo-retail-bp.docker-box.inpref.com/images/products/product-4huulipuna1.jpg",
        "manufacturer": "WakitaTiks",
        "price": 94918.71,
        "ratingurl": 3,"https://demo-retail-bp.docker-box.inpref.com/shop/product/20"
        "reviews": 15,
        "stock": 4,
        "url": "https://demo-retail-bp.docker-box.inpref.com/shop/product/4"
      }
    },
    {
      "id": "162",
      "type": "Power Tools/DrillsSaws",
      "name": "BrandixIRadix DPS3000SY Screwdriver2700 SCREW1500ACCWatts",
      "created_at": "2020-0911-15T1303T13:5921:0851+02:00",
      "updated_at": "2021-0610-09T1426T10:0613:3346+0203:00",
      "attributes": {
        "availabilitybrand": "In stockWakita",
        "badgescategory": [

        ]"Power Tools/Saws",
        "brandimage": "Cakita",
        "category": "Power Tools/Drillshttps://demo-retail-bp.docker-box.inpref.com/images/products/product-2.jpg",
        "deliverTimemanufacturer": 3,
        "discountPriceWakita": "0",
        "displayDiscountPriceprice": null,
        "displayPrice": "€1499.00"580.83,
        "imageurl": "https://demo-retail-bp.docker-box.inpref.com/imagesshop/products/product-16.jpg",
product/2"
      }
   "manufacturer": "Cakita" },
    {
      "priceid": 1499"14",
        "rating": 5"type": "Other/Compressors",
      "name": "Brandix Air Compressor DELTAKX500",
      "created_at": "2020-11-12T15:26:02+02:00",
      "updated_at": "2021-10-20T16:10:46+03:00",
      "attributes": {
 "reviews       "brand": 3"Cakita",
        "stockcategory": 5"Other/Compressors",
        "urlimage": "https://demo-retail-bp.docker-box.inpref.com/shopimages/products/product/16"
-14.jpg",
         }
"manufacturer": "Cakita",
      }
  ]
}
Code Block
languagejs
themeRDark
titleExample: Recommendation data in a response with debugging information
collapsetrue
{
  "data": [  "price": 1800.00,
        "url": "https://demo-retail-bp.docker-box.inpref.com/shop/product/14"
      }
    },
    {
      "id": "316",
      "type": "Power Tools/Drills",
      "name": "DrillBrandix Screwdriver Brandix ALX7054 200 WattsSCREW1500ACC",
      "created_at": "2020-0912-10T1323T10:5004:4130+02:00",
      "updated_at": "2021-0610-09T1326T10:2213:0931+0203:00",
      "attributes": {
        "availabilitybrand": "In stockCakita",
        "badgescategory": [

        ]"Power Tools/Drills",
        "brandimage": "Wakitahttps://demo-retail-bp.docker-box.inpref.com/images/products/product-16.jpg",
        "categorymanufacturer": "Power Tools/DrillsCakita",
        "deliverTimeprice": 11499.00,
        "discountPriceurl": "0",
https://demo-retail-bp.docker-box.inpref.com/shop/product/16"
      }
   "displayDiscountPrice": null},
    {
      "displayPriceid": "€850.0019",
        "imagetype": "https://demo-retail-bp.docker-box.inpref.com/images/products/product-3.jpg",
  Makeup/Makeup Products",
      "name": "Nail Polish Double Set",
      "manufacturercreated_at": "Wakita2020-11-03T13:24:08+02:00",
        "priceupdated_at": 850"2021-10-20T15:13:40+03:00",
        "ratingattributes": 4,{
        "reviewsbrand": 8"Tiks",
        "stockcategory": 9 "Makeup/Makeup Products",
        "urlimage": "https://demo-retail-bp.docker-box.inpref.com/shopimages/productproducts/3kynsilakat.jpg",
        "manufacturer": "Tiks",
        "price": 12.50,
        "url": "https://demo-retail-bp.docker-box.inpref.com/shop/product/19"
      }
    },
    {
      "id": "4",
      "type": "Power Tools/Drills",
      "name": "Drill Series 3 Brandix KSR4590PQS 1500 Watts",
      "created_at": "2020-0911-10T1403T13:3824:3755+02:00",
      "updated_at": "2021-0610-09T1328T08:2257:1057+0203:00",
      "attributes": {
        "availabilitybrand": "In stockWakita",
        "badgescategory": [

        ]"Power Tools/Drills",
        "brandimage": "Wakita",
        "category": "Power Tools/Drillshttps://demo-retail-bp.docker-box.inpref.com/images/products/product-4.jpg",
        "deliverTime": 3,
        "discountPricemanufacturer": "0Wakita",
        "displayDiscountPriceprice": null,
        "displayPrice": "€949949.00",
        "imageurl": "https://demo-retail-bp.docker-box.inpref.com/imagesshop/productsproduct/product-4.jpg",
        "manufacturer": "Wakita",}
    }
    "price": 949,
        "rating": 3,
        "reviews": 15,
        "stock": 4,
        "url": "https://demo-retail-bp.docker-box.inpref.com/shop/product/4"
      }
    },
    ]
}


Code Block
languagejs
themeRDark
titleExample: Response with recommendation data and debugging information
collapsetrue
{
  "data": [
    {
      "id": "165",
      "type": "Power Tools/DrillsWoodworking",
      "name": "Brandix Router ScrewdriverPower Tool SCREW1500ACC2017ERXPK",
      "created_at": "2020-0912-15T1323T10:5904:0839+02:00",
      "updated_at": "2021-0610-09T1426T10:0614:3300+0203:00",
      "attributes": {
        "availability": "In stock",
        "badges": [

        ],
        "brand": "CakitaWakita",
        "category": "Power Tools/DrillsWoodworking",
        "deliverTimeimage": 3,
        "discountPrice": "0https://demo-retail-bp.docker-box.inpref.com/images/products/product-5.jpg",
        "displayDiscountPricemanufacturer": null"Wakita",
        "displayPriceprice": "€14991700.00",
        "imageurl": "https://demo-retail-bp.docker-box.inpref.com/imagesshop/products/product-16.jpg",
  product/5"
      }
    },
    {
      "manufacturerid": "Cakita1",
      "type": "Power Tools/Woodworking",
      "pricename": 1499 "Electric Planer Brandix KL370090G 300 Watts",
      "created_at": "2020-11-09T15:51:53+02:00",
      "ratingupdated_at": 5"2021-10-15T16:39:37+03:00",
        "reviewsattributes": 3,{
        "stockbrand": 5"Wakita",
        "urlcategory": "Power Tools/Woodworking",
        "image": "https://demo-retail-bp.docker-box.inpref.com/images/shopproducts/product/16"
-1.jpg",
         }"manufacturer": "Wakita",
    }
  ],
  "debugprice": {
509.32,
        "slotsurl": ["https://demo-retail-bp.docker-box.inpref.com/shop/product/1"
      {}
    },
    "dataPoint": {
          "id": "320",
          "weighttype": 12"Makeup/Makeup Products",
      "name":  }"Lipstick, Red Perky",
        "algorithmcreated_at": "trending_viewed"
2020-11-03T13:23:59+02:00",
       },
"updated_at": "2021-10-06T15:32:26+03:00",
      "attributes": {
        "dataPointbrand": {"Tiks",
          "idcategory": "4Makeup/Makeup Products",
          "weightimage": 6
"https://demo-retail-bp.docker-box.inpref.com/images/products/huulipuna1.jpg",
         }"manufacturer": "Tiks",
        "algorithmprice": "trending_viewed"18.71,
      },  "url": "https://demo-retail-bp.docker-box.inpref.com/shop/product/20"
      {}
     },
   "dataPoint": {
          "id": "162",
          "weighttype": 6 "Power Tools/Saws",
      "name": "IRadix DPS3000SY 2700 }Watts",
        "algorithmcreated_at": "trending_viewed"
2020-11-03T13:21:51+02:00",
       }"updated_at": "2021-10-26T10:13:46+03:00",
    ],
    "dataPointsattributes": [{
         {"brand": "Wakita",
        "idcategory": "3Power Tools/Saws",
        "weightimage": 12"https://demo-retail-bp.docker-box.inpref.com/images/products/product-2.jpg",
      },
      {"manufacturer": "Wakita",
        "idprice": "4"580.83,
        "weighturl": 6"https://demo-retail-bp.docker-box.inpref.com/shop/product/2"
      },
    },
    {
        "id": "1614",
        "weighttype": 6"Other/Compressors",
      }
    ],
"name": "Brandix Air Compressor DELTAKX500",
      "recoscreated_at": [
"2020-11-12T15:26:02+02:00",
       {"updated_at": "2021-10-20T16:10:46+03:00",
        "idattributes": 2090,{
        "namebrand": "strategy52_position1_trending_viewedCakita",
        "limitcategory": 120"Other/Compressors",
        "mappingimage": "https://demo-retail-bp.docker-box.inpref.com/images/products/product-14.jpg",
        "filtersmanufacturer": ["Cakita",
          {
    "price": 1800.00,
        "Nameurl": "Only include items that match the viewed category""https://demo-retail-bp.docker-box.inpref.com/shop/product/14"
      }
    },
      {
      "Rulesid": ["16",
      "type":        {"Power Tools/Drills",
      "name": "Brandix Screwdriver  SCREW1500ACC",
      "Sourcecreated_at": "context2020-12-23T10:04:30+02:00",
                "SourcePath"updated_at": "page.category.categories2021-10-26T10:13:31+03:00",
        "attributes": {
        "Attributebrand": "typeCakita",
        "category": "Power Tools/Drills",
        "Operatorimage": "startsWithAnyhttps://demo-retail-bp.docker-box.inpref.com/images/products/product-16.jpg",
        "manufacturer": "Cakita",
        "Valueprice": ""1499.00,
        "url": "https://demo-retail-bp.docker-box.inpref.com/shop/product/16"
      }
    },
    {
    ]  "id": "19",
      "type": "Makeup/Makeup Products",
  }
    "name": "Nail Polish Double ]Set",
        "postDynamicFilterscreated_at": ["2020-11-03T13:24:08+02:00",
      "updated_at": "2021-10-20T15:13:40+03:00",
   {
   "attributes": {
        "ParamNamebrand": "typeTiks",
            "Operatorcategory": "startsWithAnyMakeup/Makeup Products",
            "Comparatorimage": "[\"Power Tools/Drills\"]"https://demo-retail-bp.docker-box.inpref.com/images/products/kynsilakat.jpg",
        "manufacturer": "Tiks",
 }
        ]"price": 12.50,
        "modelUpdatedAturl": "2021-06-09T11:29:26Z",
https://demo-retail-bp.docker-box.inpref.com/shop/product/19"
      }
   "params": null},
    {
      "excludeIdsid": null"4",
        "dataPointstype": ["Power Tools/Drills",
      "name": "Drill Series 3 {
Brandix KSR4590PQS    1500 Watts",
       "idcreated_at": "32020-11-03T13:24:55+02:00",
      "updated_at": "2021-10-28T08:57:57+03:00",
      "weightattributes": 12{
          }"brand": "Wakita",
        "category":  {"Power Tools/Drills",
            "idimage": "https://demo-retail-bp.docker-box.inpref.com/images/products/product-4.jpg",
            "weightmanufacturer": 6"Wakita",
          }"price": 949.00,
          {
"url": "https://demo-retail-bp.docker-box.inpref.com/shop/product/4"
      }
    }
  ],
  "iddebug": {
    "16slots",: [
      {
        "weightdataPoint": 6{
           }"id": "5",
        ]
    "weight": 4
  },
      {},
        "idalgorithm": 2091,
"popular_viewed"
      },
     "name": "strategy52_position2_trending_bought", {
        "limitdataPoint": 120,{
          "mappingid": "product1",
          "filtersweight": [3
          {
    },
        "Namealgorithm": "Only include items that match the viewed category",
"popular_viewed"
      },
      {
        "RulesdataPoint": [
{
          "id": "20",
          "weight": {3
        },
        "Sourcealgorithm": "contextpopular_viewed",
      },
      {
        "SourcePathdataPoint": "page.category.categories",
      {
          "Attributeid": "type2",
                "Operator"weight": "startsWithAny",2
        },
        "Valuealgorithm": "popular_viewed"
      },
        }{
          "dataPoint": {
  ]
          }
        ],
"id": "14",
          "postDynamicFiltersweight": [1
        },
  {
      "algorithm": "popular_viewed"
     "ParamName": "type" },
      {
        "OperatordataPoint": "startsWithAny",{
            "Comparatorid": "[\16"Power Tools/Drills\"]"
,
          "weight": }1
        ]},
        "modelUpdatedAtalgorithm": "2021-06-09T11:11:44Z",
popular_viewed"
      },
     "params": null, {
        "excludeIdsdataPoint": null,{
          "dataPointsid": null
    "19",
  }
    ],
    "strategyweight": {1
       "site_id": 2271 },
      "id": 52,
      "id_stringalgorithm": "trending-in-category",popular_viewed"
      "slots": [
},
      ],{
        "positionsdataPoint": [{
           {"id": "4",
          "idweight": 1,
          "items": 4},
          "algorithm": "trendingpopular_viewed",
      }
    ],
    "reco_iddataPoints": 2090,
[
      {
        "anchor_sourceid": "5",
          "anchor_source_path": "",
  "weight": 4
      },
      {
        "anchor_itemsid": 0
  "1",
        "weight": 3
      },
        {
          "id": 2"20",
          "itemsweight": 4 3
      },
      {
        "algorithmid": "trending_bought2",
          "reco_idweight": 2091,2
      },
     "anchor_source": "",
   {
        "anchor_source_pathid": "14",
          "anchor_itemsweight": 01
        },
      ],{
        "updated_atid": "2021-03-12T06:56:47Z"16",
    },
    "positionsweight": [ 1
      },
      {
        "id": 1"19",
        "dataPointsweight": [1
      },
      {
            "id": "34",
            "weight": 121
      }
    }],
    "recos": [
      {
        "id": 2471,
        "idname": "4strategy89_position1_popular_viewed",
            "weightlimit": 6120,
          }"mapping": "product",
          {
    "filters": null,
        "idpostDynamicFilters": "16"null,
         "modelUpdatedAt": "2021-11-01T12:25:07Z",
        "weightupdatedAt": 6"2021-11-01T12:25:55Z",
        "params": null,
 }
       "excludeIds": ]null,
        "addedDataPointsdataPoints": [
          {
            "id": "35",
            "weight": 124
          },
          {
            "id": "41",
            "weight": 63
          },
          {
            "id": "1620",
            "weight": 63
          },
          ],
{
            "duplicateDataPointsid": [

"2",
            "weight": ]2
          },
          {
            "id": 2"14",
            "dataPointsweight": [1

          ]},
        "addedDataPoints": [

  {
             ]"id": "16",
            "duplicateDataPointsweight": [

    1
    ]
      },
     ],
    "context": {
      "page": {
        "typeid": "category19",
            "cartweight": null,1
         "category": { },
          "name": "Power Tools/Drills",
{
            "categoriesid": ["4",
            "Power Tools/Drills"weight": 1
          ]}
        }],
        "productdetails": null,[
          "search": null
      },
loading the created recommendation configuration at 2021-11-01T17:19:20+02:00",
       "user": {
  "loading the recommendation model data from "area": "Graniitti API",
          "lastBought": {loading the recommendation model data",
          "ids": [
loading the recommendation model data (internal)",
          ],
"success with loading the recommendation model data. Took 188.238346ms to "categories": [
complete"
          ]
        },
    ],
    "lastViewedstrategy": {
          "idssite_id": [
2265,
          ]"id": 89,
      "id_string": "most-popular-overall",
      "categoriesslots": [

      ],
      "positions": ][
        },{
          "mostViewedid": {1,
          "idsitems": [8,

           ]"algorithm": "popular_viewed",
          "categoriesreco_id": [2471,

           ]"anchor_source": "",
        }
  "anchor_source_path": "",
   }
    },
    "productAPIanchor_items": [0
        {}
      ],
      "idaffinity_percentage": "3"0,
        "messageupdated_at": "added product data",2020-11-03T11:42:56Z"
    },
    "cachedpositions": false[
      },{
         {"id": 1,
        "iddataPoints": "4",
 [
          {
            "messageid": "added product data5",
            "cachedweight": false4
          },
          {
            "id": "161",
            "messageweight": "added product data"3
          },
        "cached": false  {
      }
    ]
  }
}

If there's no recommendation data available for the requested strategy, the API returns an empty array.

Code Block
languagejs
themeRDark
{
  "data": []
}

Error

On an error, the Recommendations API returns the response status code 400 and an error message.

Table: Recommendations API error messages

...

  "id": "20",
            "weight": 3
          },
          {
            "id": "2",
            "weight": 2
          },
          {
            "id": "14",
            "weight": 1
          },
          {
            "id": "16",
            "weight": 1
          },
          {
            "id": "19",
            "weight": 1
          },
          {
            "id": "4",
            "weight": 1
          }
        ],
        "addedDataPoints": [
          {
            "id": "5",
            "weight": 4
          },
          {
            "id": "1",
            "weight": 3
          },
          {
            "id": "20",
            "weight": 3
          },
          {
            "id": "2",
            "weight": 2
          },
          {
            "id": "14",
            "weight": 1
          },
          {
            "id": "16",
            "weight": 1
          },
          {
            "id": "19",
            "weight": 1
          },
          {
            "id": "4",
            "weight": 1
          }
        ],
        "duplicateDataPoints": [

        ],
        "affinity": {
          "maxScore": 0,
          "maxWeight": 0,
          "products": [

          ],
          "dataPoints": [

          ],
          "details": [

          ]
        }
      }
    ],
    "affinity": {
      "applied": false,
      "userScores": null,
      "percentage": 0,
      "products": [

      ],
      "dataPoints": [

      ],
      "details": [
        "not applied. Affinity percentage is less than or equal to 0",
        "not applied. Cookie ID is missing"
      ]
    },
    "context": {
      "page": null,
      "user": null
    },
    "productAPI": [
      {
        "id": "5",
        "message": "added product data",
        "cached": false
      },
      {
        "id": "1",
        "message": "added product data",
        "cached": false
      },
      {
        "id": "20",
        "message": "added product data",
        "cached": false
      },
      {
        "id": "2",
        "message": "added product data",
        "cached": false
      },
      {
        "id": "14",
        "message": "added product data",
        "cached": false
      },
      {
        "id": "16",
        "message": "added product data",
        "cached": false
      },
      {
        "id": "19",
        "message": "added product data",
        "cached": false
      },
      {
        "id": "4",
        "message": "added product data",
        "cached": false
      }
    ]
  }
}

The following example shows a debug-enabled response for a strategy that applies visitor affinity.

Code Block
languagejs
themeRDark
titleExample: Response with recommendation data and debugging information for a strategy that applies affinity
collapsetrue
{
  "data": [
    {
      "id": "2",
      "type": "Power Tools/Saws",
      "name": "IRadix DPS3000SY 2700 Watts",
      "created_at": "2020-11-03T13:21:51+02:00",
      "updated_at": "2021-10-26T10:13:46+03:00",
      "attributes": {
        "brand": "Wakita",
        "category": "Power Tools/Saws",
        "image": "https://demo-retail-bp.docker-box.inpref.com/images/products/product-2.jpg",
        "manufacturer": "Wakita",
        "price": 580.83,
        "url": "https://demo-retail-bp.docker-box.inpref.com/shop/product/2"
      }
    },
    {
      "id": "5",
      "type": "Power Tools/Woodworking",
      "name": "Brandix Router Power Tool 2017ERXPK",
      "created_at": "2020-12-23T10:04:39+02:00",
      "updated_at": "2021-10-26T10:14:00+03:00",
      "attributes": {
        "brand": "Wakita",
        "category": "Power Tools/Woodworking",
        "image": "https://demo-retail-bp.docker-box.inpref.com/images/products/product-5.jpg",
        "manufacturer": "Wakita",
        "price": 1700.00,
        "url": "https://demo-retail-bp.docker-box.inpref.com/shop/product/5"
      }
    },
    {
      "id": "1",
      "type": "Power Tools/Woodworking",
      "name": "Electric Planer Brandix KL370090G 300 Watts",
      "created_at": "2020-11-09T15:51:53+02:00",
      "updated_at": "2021-10-15T16:39:37+03:00",
      "attributes": {
        "brand": "Wakita",
        "category": "Power Tools/Woodworking",
        "image": "https://demo-retail-bp.docker-box.inpref.com/images/products/product-1.jpg",
        "manufacturer": "Wakita",
        "price": 509.32,
        "url": "https://demo-retail-bp.docker-box.inpref.com/shop/product/1"
      }
    },
    {
      "id": "4",
      "type": "Power Tools/Drills",
      "name": "Drill Series 3 Brandix KSR4590PQS 1500 Watts",
      "created_at": "2020-11-03T13:24:55+02:00",
      "updated_at": "2021-10-28T08:57:57+03:00",
      "attributes": {
        "brand": "Wakita",
        "category": "Power Tools/Drills",
        "image": "https://demo-retail-bp.docker-box.inpref.com/images/products/product-4.jpg",
        "manufacturer": "Wakita",
        "price": 949.00,
        "url": "https://demo-retail-bp.docker-box.inpref.com/shop/product/4"
      }
    },
    {
      "id": "16",
      "type": "Power Tools/Drills",
      "name": "Brandix Screwdriver SCREW1500ACC",
      "created_at": "2020-12-23T10:04:30+02:00",
      "updated_at": "2021-10-26T10:13:31+03:00",
      "attributes": {
        "brand": "Cakita",
        "category": "Power Tools/Drills",
        "image": "https://demo-retail-bp.docker-box.inpref.com/images/products/product-16.jpg",
        "manufacturer": "Cakita",
        "price": 1499.00,
        "url": "https://demo-retail-bp.docker-box.inpref.com/shop/product/16"
      }
    }
  ],
  "debug": {
    "slots": [
      {
        "dataPoint": {
          "id": "2",
          "weight": 2
        },
        "algorithm": "popular_viewed"
      },
      {
        "dataPoint": {
          "id": "5",
          "weight": 4
        },
        "algorithm": "popular_viewed"
      },
      {
        "dataPoint": {
          "id": "1",
          "weight": 3
        },
        "algorithm": "popular_viewed"
      },
      {
        "dataPoint": {
          "id": "4",
          "weight": 1
        },
        "algorithm": "popular_viewed"
      },
      {
        "dataPoint": {
          "id": "16",
          "weight": 1
        },
        "algorithm": "popular_viewed"
      }
    ],
    "dataPoints": [
      {
        "id": "2",
        "weight": 2
      },
      {
        "id": "5",
        "weight": 4
      },
      {
        "id": "1",
        "weight": 3
      },
      {
        "id": "4",
        "weight": 1
      },
      {
        "id": "16",
        "weight": 1
      }
    ],
    "recos": [
      {
        "id": 2916,
        "name": "strategy277_position1_popular_viewed",
        "limit": 120,
        "mapping": "product",
        "filters": null,
        "postDynamicFilters": null,
        "modelUpdatedAt": "2021-11-01T12:24:56Z",
        "updatedAt": "2021-11-01T12:26:33Z",
        "params": null,
        "excludeIds": null,
        "dataPoints": [
          {
            "id": "5",
            "weight": 4
          },
          {
            "id": "1",
            "weight": 3
          },
          {
            "id": "20",
            "weight": 3
          },
          {
            "id": "2",
            "weight": 2
          },
          {
            "id": "14",
            "weight": 1
          },
          {
            "id": "16",
            "weight": 1
          },
          {
            "id": "19",
            "weight": 1
          },
          {
            "id": "4",
            "weight": 1
          }
        ],
        "details": [
          "loading the created recommendation configuration at 2021-11-01T17:18:29+02:00",
          "loading the recommendation model data from Graniitti API",
          "loading the recommendation model data",
          "loading the recommendation model data (internal)",
          "success with loading the recommendation model data. Took 195.195876ms to complete"
        ]
      },
      {
        "id": 2951,
        "name": "strategy277_position2_longterm_bought",
        "limit": 120,
        "mapping": "product",
        "filters": null,
        "postDynamicFilters": null,
        "modelUpdatedAt": "2021-11-01T12:25:01Z",
        "updatedAt": "2021-11-01T12:25:56Z",
        "params": null,
        "excludeIds": null,
        "dataPoints": [
          {
            "id": "1",
            "weight": 1
          }
        ],
        "details": [
          "loading the created recommendation configuration at 2021-11-01T17:19:40+02:00",
          "loading the recommendation model data from Graniitti API",
          "loading the recommendation model data",
          "loading the recommendation model data (internal)",
          "success with loading the recommendation model data. Took 191.043085ms to complete"
        ]
      }
    ],
    "strategy": {
      "site_id": 2265,
      "id": 277,
      "id_string": "with-affinity",
      "slots": [

      ],
      "positions": [
        {
          "id": 1,
          "items": 5,
          "algorithm": "popular_viewed",
          "reco_id": 2916,
          "anchor_source": "",
          "anchor_source_path": "",
          "anchor_items": 0
        },
        {
          "id": 2,
          "items": 10,
          "algorithm": "longterm_bought",
          "reco_id": 2951,
          "anchor_source": "",
          "anchor_source_path": "",
          "anchor_items": 0
        }
      ],
      "affinity_percentage": 100,
      "updated_at": "2021-09-15T13:46:32Z"
    },
    "positions": [
      {
        "id": 1,
        "dataPoints": [
          {
            "id": "2",
            "weight": 2
          },
          {
            "id": "5",
            "weight": 4
          },
          {
            "id": "1",
            "weight": 3
          },
          {
            "id": "4",
            "weight": 1
          },
          {
            "id": "16",
            "weight": 1
          },
          {
            "id": "20",
            "weight": 3
          },
          {
            "id": "19",
            "weight": 1
          },
          {
            "id": "14",
            "weight": 1
          }
        ],
        "addedDataPoints": [
          {
            "id": "2",
            "weight": 2
          },
          {
            "id": "5",
            "weight": 4
          },
          {
            "id": "1",
            "weight": 3
          },
          {
            "id": "4",
            "weight": 1
          },
          {
            "id": "16",
            "weight": 1
          }
        ],
        "duplicateDataPoints": [

        ],
        "affinity": {
          "maxScore": 152,
          "maxWeight": 4,
          "products": [
            {
              "id": "5",
              "attributes": {
                "brand": {
                  "score": 112,
                  "value": "Wakita"
                },
                "type": {
                  "score": 32,
                  "value": "Power Tools/Woodworking"
                }
              },
              "nonNormalizedWeight": 4,
              "normalizedWeight": 1,
              "nonNormalizedScore": 144,
              "normalizedScore": 0.9473684210526315,
              "affinity": 0.9473684210526315
            },
            {
              "id": "1",
              "attributes": {
                "brand": {
                  "score": 112,
                  "value": "Wakita"
                },
                "type": {
                  "score": 32,
                  "value": "Power Tools/Woodworking"
                }
              },
              "nonNormalizedWeight": 3,
              "normalizedWeight": 0.75,
              "nonNormalizedScore": 144,
              "normalizedScore": 0.9473684210526315,
              "affinity": 0.9473684210526315
            },
            {
              "id": "20",
              "attributes": {
                "brand": {
                  "score": 8,
                  "value": "Tiks"
                },
                "type": {
                  "score": 8,
                  "value": "Makeup/Makeup Products"
                }
              },
              "nonNormalizedWeight": 3,
              "normalizedWeight": 0.75,
              "nonNormalizedScore": 16,
              "normalizedScore": 0.10526315789473684,
              "affinity": 0.10526315789473684
            },
            {
              "id": "2",
              "attributes": {
                "brand": {
                  "score": 112,
                  "value": "Wakita"
                },
                "type": {
                  "score": 40,
                  "value": "Power Tools/Saws"
                }
              },
              "nonNormalizedWeight": 2,
              "normalizedWeight": 0.5,
              "nonNormalizedScore": 152,
              "normalizedScore": 1,
              "affinity": 1
            },
            {
              "id": "14",
              "attributes": {
                "brand": {
                  "score": 0,
                  "value": "Cakita"
                },
                "type": {
                  "score": 0,
                  "value": "Other/Compressors"
                }
              },
              "details": [
                "invalid \"brand\" product attribute score. Should be greater than zero, got 0.00",
                "invalid \"type\" product attribute score. Should be greater than zero, got 0.00"
              ],
              "nonNormalizedWeight": 1,
              "normalizedWeight": 0.25,
              "nonNormalizedScore": 0,
              "normalizedScore": 0,
              "affinity": 0
            },
            {
              "id": "16",
              "attributes": {
                "brand": {
                  "score": 0,
                  "value": "Cakita"
                },
                "type": {
                  "score": 32,
                  "value": "Power Tools/Drills"
                }
              },
              "details": [
                "invalid \"brand\" product attribute score. Should be greater than zero, got 0.00"
              ],
              "nonNormalizedWeight": 1,
              "normalizedWeight": 0.25,
              "nonNormalizedScore": 32,
              "normalizedScore": 0.21052631578947367,
              "affinity": 0.21052631578947367
            },
            {
              "id": "19",
              "attributes": {
                "brand": {
                  "score": 8,
                  "value": "Tiks"
                },
                "type": {
                  "score": 8,
                  "value": "Makeup/Makeup Products"
                }
              },
              "nonNormalizedWeight": 1,
              "normalizedWeight": 0.25,
              "nonNormalizedScore": 16,
              "normalizedScore": 0.10526315789473684,
              "affinity": 0.10526315789473684
            },
            {
              "id": "4",
              "attributes": {
                "brand": {
                  "score": 112,
                  "value": "Wakita"
                },
                "type": {
                  "score": 32,
                  "value": "Power Tools/Drills"
                }
              },
              "nonNormalizedWeight": 1,
              "normalizedWeight": 0.25,
              "nonNormalizedScore": 144,
              "normalizedScore": 0.9473684210526315,
              "affinity": 0.9473684210526315
            }
          ],
          "dataPoints": [
            {
              "id": "2",
              "weight": 1
            },
            {
              "id": "5",
              "weight": 0.9473684210526315
            },
            {
              "id": "1",
              "weight": 0.9473684210526315
            },
            {
              "id": "4",
              "weight": 0.9473684210526315
            },
            {
              "id": "16",
              "weight": 0.21052631578947367
            },
            {
              "id": "20",
              "weight": 0.10526315789473684
            },
            {
              "id": "19",
              "weight": 0.10526315789473684
            },
            {
              "id": "14",
              "weight": 0
            }
          ],
          "details": [
            "applied for product \"5\". Normalized affinity score: 0.95. Affinity: 0.95",
            "applied for product \"1\". Normalized affinity score: 0.95. Affinity: 0.95",
            "applied for product \"20\". Normalized affinity score: 0.11. Affinity: 0.11",
            "applied for product \"2\". Normalized affinity score: 1.00. Affinity: 1.00",
            "applied for product \"14\". Normalized affinity score: 0.00. Affinity: 0.00",
            "applied for product \"16\". Normalized affinity score: 0.21. Affinity: 0.21",
            "applied for product \"19\". Normalized affinity score: 0.11. Affinity: 0.11",
            "applied for product \"4\". Normalized affinity score: 0.95. Affinity: 0.95"
          ]
        }
      },
      {
        "id": 2,
        "dataPoints": [
          {
            "id": "1",
            "weight": 1
          }
        ],
        "addedDataPoints": [

        ],
        "duplicateDataPoints": [
          {
            "id": "1",
            "weight": 1
          }
        ],
        "affinity": {
          "maxScore": 144,
          "maxWeight": 1,
          "products": [
            {
              "id": "1",
              "attributes": {
                "brand": {
                  "score": 112,
                  "value": "Wakita"
                },
                "type": {
                  "score": 32,
                  "value": "Power Tools/Woodworking"
                }
              },
              "nonNormalizedWeight": 1,
              "normalizedWeight": 1,
              "nonNormalizedScore": 144,
              "normalizedScore": 1,
              "affinity": 1
            }
          ],
          "dataPoints": [
            {
              "id": "1",
              "weight": 1
            }
          ],
          "details": [
            "applied for product \"1\". Normalized affinity score: 1.00. Affinity: 1.00"
          ]
        }
      }
    ],
    "affinity": {
      "applied": true,
      "userScores": {
        "scores": {
          "brand": {
            "Tiks": 8,
            "Wakita": 112
          },
          "type": {
            "Hand tools/Wrenches and Pliers": 8,
            "Makeup/Makeup Products": 8,
            "Power Tools/Drills": 32,
            "Power Tools/Saws": 40,
            "Power Tools/Woodworking": 32
          }
        },
        "created_at": "2021-11-02T08:35:02+02:00",
        "updated_at": "2021-11-02T08:35:53+02:00"
      },
      "percentage": 100,
      "products": [
        {
          "id": "5",
          "attributes": {
            "brand": {
              "score": 112,
              "value": "Wakita"
            },
            "type": {
              "score": 32,
              "value": "Power Tools/Woodworking"
            }
          },
          "nonNormalizedWeight": 4,
          "normalizedWeight": 1,
          "nonNormalizedScore": 144,
          "normalizedScore": 0.9473684210526315,
          "affinity": 0.9473684210526315
        },
        {
          "id": "1",
          "attributes": {
            "brand": {
              "score": 112,
              "value": "Wakita"
            },
            "type": {
              "score": 32,
              "value": "Power Tools/Woodworking"
            }
          },
          "nonNormalizedWeight": 3,
          "normalizedWeight": 0.75,
          "nonNormalizedScore": 144,
          "normalizedScore": 0.9473684210526315,
          "affinity": 0.9473684210526315
        },
        {
          "id": "2",
          "attributes": {
            "brand": {
              "score": 112,
              "value": "Wakita"
            },
            "type": {
              "score": 40,
              "value": "Power Tools/Saws"
            }
          },
          "nonNormalizedWeight": 2,
          "normalizedWeight": 0.5,
          "nonNormalizedScore": 152,
          "normalizedScore": 1,
          "affinity": 1
        },
        {
          "id": "16",
          "attributes": {
            "brand": {
              "score": 0,
              "value": "Cakita"
            },
            "type": {
              "score": 32,
              "value": "Power Tools/Drills"
            }
          },
          "details": [
            "invalid \"brand\" product attribute score. Should be greater than zero, got 0.00"
          ],
          "nonNormalizedWeight": 1,
          "normalizedWeight": 0.25,
          "nonNormalizedScore": 32,
          "normalizedScore": 0.21052631578947367,
          "affinity": 0.21052631578947367
        },
        {
          "id": "4",
          "attributes": {
            "brand": {
              "score": 112,
              "value": "Wakita"
            },
            "type": {
              "score": 32,
              "value": "Power Tools/Drills"
            }
          },
          "nonNormalizedWeight": 1,
          "normalizedWeight": 0.25,
          "nonNormalizedScore": 144,
          "normalizedScore": 0.9473684210526315,
          "affinity": 0.9473684210526315
        }
      ],
      "dataPoints": [
        {
          "id": "2",
          "weight": 1
        },
        {
          "id": "5",
          "weight": 0.9473684210526315
        },
        {
          "id": "4",
          "weight": 0.9473684210526315
        },
        {
          "id": "20",
          "weight": 0.10526315789473684
        },
        {
          "id": "14",
          "weight": 0
        }
      ],
      "details": [
        "applied for product \"5\". Normalized affinity score: 0.95. Affinity: 0.95",
        "applied for product \"1\". Normalized affinity score: 0.95. Affinity: 0.95",
        "applied for product \"2\". Normalized affinity score: 1.00. Affinity: 1.00",
        "applied for product \"16\". Normalized affinity score: 0.21. Affinity: 0.21",
        "applied for product \"4\". Normalized affinity score: 0.95. Affinity: 0.95"
      ]
    },
    "context": {
      "page": null,
      "user": null
    },
    "productAPI": [
      {
        "id": "5",
        "message": "added product data",
        "cached": false
      },
      {
        "id": "1",
        "message": "added product data",
        "cached": false
      },
      {
        "id": "20",
        "message": "added product data",
        "cached": false
      },
      {
        "id": "2",
        "message": "added product data",
        "cached": false
      },
      {
        "id": "14",
        "message": "added product data",
        "cached": false
      },
      {
        "id": "16",
        "message": "added product data",
        "cached": false
      },
      {
        "id": "19",
        "message": "added product data",
        "cached": false
      },
      {
        "id": "4",
        "message": "added product data",
        "cached": false
      }
    ]
  }
}

Error

On an error, the Recommendations API returns the response status code 400 and an error message.

Table: Recommendations API error messages

Error messageDescriptionSolution


Code Block
languagetext
themeRDark
parameter 'method' missing


The method query parameter is missing from the request URL.Provide the method query parameter.


Code Block
languagetext
themeRDark
parameter 'method' contains an empty value


The value of the method query parameter is missing.Provide a non-empty value for the method query parameter.


Code Block
languagetext
themeRDark
invalid method '<parameter_value>'


The value of the method query parameter, <parameter_value>, is invalid.Provide strategy as the value of the method query parameter.


Code Block
languagetext
themeRDark
parameter 'origin' missing


The origin query parameter is missing from the request URL.Provide the origin query parameter.


Code Block
languagetext
themeRDark
parameter 'origin' contains an empty value


The value of the origin query parameter is missing.Provide a non-empty value for the origin query parameter.


Code Block
languagetext
themeRDark
invalid origin parameter '<parameter_value>'


The value of the origin query parameter, <parameter_value>, is invalid.

Provide a valid site origin as the value of the origin query parameter.

To find out your site's origin, see Getting your site origin.


Code Block
languagetext
themeRDark
parameter 'strategy' missing


The strategy query parameter is missing from the request URL.Provide the strategy query parameter.


Code Block
languagetext
themeRDark
parameter 'method' missing
The method query parameter is missing from the request URL or its value is undefined.Make sure that the method query parameter is properly defined
strategy' contains an empty value


The value of the strategy query parameter is missing.Provide a non-empty value for the strategy query parameter.


Code Block
languagetext
themeRDark
invalid strategy methodparameter '<parameter_value>'


The value of the method query strategy query parameter, <parameter_value>, is invalid.Use Provide a valid strategy ID as the value of the methodthe strategy query parameter.


Code Block
languagetext
themeRDark
parameter 'origin' missing
The origin
cookieId' contains an empty value


The value of the cookieId query parameter is missing from the request URL or its value is undefined.Make sure that the origin query parameter is properly defined.Provide a non-empty value for the cookieId query parameter.


Code Block
languagetext
themeRDark
invalid origin parameter '<parameter_value>context' missing


The value of the origin context query parameter , <parameter_value>, is invalid.

Use a valid site origin as the value of the origin query parameter.

To find out your site's origin, see Getting your site origin.

is missing from the request URL.Provide the context query parameter.


Code Block
languagetext
themeRDark
parameter 'strategy' missing
The strategy query parameter is missing from the request URL or its value is undefined.Make sure that the strategy query parameter is properly defined
context' contains an empty value


The value of the context query parameter is missing.Provide a non-empty value for the context query parameter.


Code Block
languagetext
themeRDark
parameter 'context' contains invalid strategy parameter '<parameter_value>'JSON: <json_error>


The value of the strategy context query parameter , <parameter_value>, is invalidis not a valid JSON object.Use Provide a valid strategy ID JSON object as the value of the strategythe context query parameter.


Code Block
languagetext
themeRDark
parameter 'context' missing
The context query parameter is missing from the request URL or its value is undefined
error retrieving value from context using path '<context_property_path>': expected string or array of strings for path: '<context_property_path>'


The value of the context query parameter does not contain the required context information, <context_property_path>, or one or more of the object properties containing the information are incorrectly named.Make sure that the value of the context query parameter is properly definedparameter contains the required context information and that all the object properties are correctly named.


Code Block
languagetext
themeRDark
parameter 'contextaffinityPercentage' invalid, expected containsvalue invalidbetween JSON:0 failedand to100 parse(inclusive)


The value of the context affinityPercentage query parameter is not a valid JSON objectinvalid.Use a valid JSON object as Set the value of the context query parameter affinityPercentage query parameter to an integer that is greater than or equal to 0 and less than or equal to 100.


Code Block
languagetext
themeRDark
error retrieving value from context using path '<context_property_path>':parameter 'shuffle' invalid, expected string or array of strings for path: '<context_property_path>either 'true', 'false', '1' or '0'


The value of the context query parameter does not contain the required context information, <context_property_path>, or one or more of the object properties containing the information are incorrectly named.Make sure that the value of the context query parameter contains the required context information and that all the object properties are correctly named shuffle query parameter is invalid.

If you want to shuffle the order of items, set the shuffle query parameter to either true or 1.

If you do not want to shuffle the order of items, set the shuffle query parameter to either false or 0, or omit the parameter from the request URL.