Recommendations

Recommend Users to Item

Recommends users that are likely to be interested in the given item.

It is also possible to use POST HTTP method (for example in the case of a very long ReQL filter) - query parameters then become body parameters.

The returned users are sorted by predicted interest in the item (the first user being the most interested).

post/{databaseId}/recomms/items/{itemId}/users/

Path parameters

databaseIdstring required

ID of your database.

itemIdstring required

ID of the item for which the recommendations are to be generated.

Request body

countinteger required

Number of users to be recommended (N for the top-N recommendation).

scenariostring

Scenario defines a particular application of recommendations. It can be, for example, "homepage", "cart", or "emailing".

You can set various settings to the scenario in the Admin UI. You can also see the performance of each scenario in the Admin UI separately, so you can check how well each application performs.

The AI that optimizes models to get the best results may optimize different scenarios separately or even use different models in each of the scenarios.

cascadeCreateboolean

If an item of the given itemId doesn't exist in the database, it creates the missing item.

returnPropertiesboolean

With returnProperties=true, property values of the recommended users are returned along with their IDs in a JSON dictionary. The acquired property values can be used to easily display the recommended users.

Example response:

  {
    "recommId": "039b71dc-b9cc-4645-a84f-62b841eecfce",
    "recomms":
      [
        {
          "id": "user-17",
          "values": {
            "country": "US",
            "sex": "F"
          }
        },
        {
          "id": "user-2",
          "values": {
            "country": "CAN",
            "sex": "M"
          }
        }
      ],
    "numberNextRecommsCalls": 0
  }
includedPropertiesstring[]

Allows specifying which properties should be returned when returnProperties=true is set. The properties are given as a comma-separated list.

Example response for includedProperties=country:

  {
    "recommId": "b2b355dd-972a-4728-9c6b-2dc229db0678",
    "recomms":
      [
        {
          "id": "user-17",
          "values": {
            "country": "US"
          }
        },
        {
          "id": "user-2",
          "values": {
            "country": "CAN"
          }
        }
      ],
    "numberNextRecommsCalls": 0
  }
filterstring

Boolean-returning ReQL expression, which allows you to filter recommended users based on the values of their attributes.

Filters can also be assigned to a scenario in the Admin UI.

boosterstring

Number-returning ReQL expression, which allows you to boost the recommendation rate of some users based on the values of their attributes.

Boosters can also be assigned to a scenario in the Admin UI.

reqlExpressionsobject

A dictionary of ReQL expressions that will be executed for each recommended user. This can be used to compute additional properties of the recommended users that are not stored in the database.

The keys are the names of the expressions, and the values are the actual ReQL expressions.

Example request:

{
  "reqlExpressions": {
    "isInUsersCity": "context_user[\"city\"] in 'cities'",
    "distanceToUser": "earth_distance('location', context_user[\"location\"])",
    "isFromSameCompany": "'company' == context_item[\"company\"]"
  }
}

Example response:

{
  "recommId": "ce52ada4-e4d9-4885-943c-407db2dee837",
  "recomms": 
    [
      {
        "id": "restaurant-178",
        "reqlEvaluations": {
          "isInUsersCity": true,
          "distanceToUser": 5200.2,
          "isFromSameCompany": false
        }
      },
      {
        "id": "bar-42",
        "reqlEvaluations": {
          "isInUsersCity": false,
          "distanceToUser": 2516.0,
          "isFromSameCompany": true
        }
      }
    ],
   "numberNextRecommsCalls": 0
}
diversitynumber double

Expert option: Real number from [0.0, 1.0], which determines how mutually dissimilar the recommended users should be. The default value is 0.0, i.e., no diversification. Value 1.0 means maximal diversification.

expertSettingsobject

Dictionary of custom options.

returnAbGroupboolean

If there is a custom AB-testing running, return the name of the group to which the request belongs.

Response

Successful operation.

recommIdstring required

Id of the recommendation request

numberNextRecommsCallsinteger

How many times Recommend Next Items have been called for this recommId

abGroupstring

Name of AB-testing group to which the request belongs if there is a custom AB-testing running.

Changes

No recorded changes to this endpoint across all 1 revision of this API.