User Context - Preferences

Created by Pedro Ondiviela · last update June 5, 2020

About this Endpoint

Returns the top product attributes for a specific user.

The product attribute preferences are calculated based on user clicks, add-to-carts and purchases and the values are normalized using a linear function.

Request URL example

GET https://api.empathybroker.com/contextsearch/v2/usercontext/preferences/{instance_id}?{Input_Parameters}

Input Parameters

Parameter name Data Type
Required:  
user String
Not required:  
session String
rows Integer


Responses

Responses examples for successful and failing calls to the endpoint.

userPreferences” objects don’t have a fixed order and it may change in between requests. Nevertheless, values for each preference are sorted by “weight” in descending order.

Remember that your EB Contextualize configuration could use different fields for the preferences calculations, so the ones showing aside (“brand” and “gender”) are just examples.

200 400 404

Successful request

Type: application/json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{
  "userPreferences": [
    {
      "field": "brand",
      "values": [
        {"value": "apple", "weight": 3},
        {"value": "sony", "weight": 2.1}
      ]
    },
    {
      "field": "gender",
      "values": [
        {"value": "woman", "weight": 3}
      ]
    }
  ],
  "sessionPreferences": [
    {
      "field": "brand",
      "values": [
        {"value": "apple", "weight": 3}
      ]
    },
    {
      "field": "gender",
      "values": [
        {"value": "woman", "weight": 3}
      ]
    }
  ]
}