Retrieve recommendations for a specific customer. This is a definition of the Customer attributes method used to retrieve customer recommendations.
Authorization
| Available access type | Permissions needed |
|---|---|
| Public access | None |
| Private access | Definitions > Get |
Attributes object definition for Customer recommendations
Each recommendation attribute object in the Customer attributes method must have type, id, and fillWithRandom properties specified. In addition to those, there are other optional properties that can be specified.
| Parameter | Type | Description | Required |
|---|---|---|---|
| type | string | "recommendation" | Required |
| id | string | The ID of the recommendation you want to retrieve. | Required |
| fillWithRandom | boolean | true = Fills the recommendations with random items until the size is reached. This is utilized when models cannot recommend enough items. | Required |
| size | int32 | Specifies the upper limit for the number of recommendations to return. Defaults to 10. | No |
| items | Array | items - If present, the recommendations are related not only to a customer but to products with IDs specified in this array. Item IDs from the catalog used to train the recommendation model need to be used. Input product IDs in a dictionary as {[product_id]: [weight]}, where the value weight determines the preference strength for the given product (bigger number = higher preference).For example: json {"123": 1, "234": 2, "345": 4} | No |
| catalogAttributesWhitelist | Array | Returns only a specified subset of attributes from catalog items. If empty or not set, returns everything. For example: json ["item_id", "title", "link", "image_link"] | No |
| catalogFilter | ? | Adds additional constraints to the catalog when retrieving recommended items Only properties set as searchable/indexed in the catalog can be used in the filter. | No |
| categoryNames | Array | Category or categories in an array from the catalog for which the desired metric is calculated. For example: ['shoes', 'high heels'] or ['shoes'] in case of a single category. | Used and required only with Metric based category model |
Data types and operands
| Data type or operand | Available values |
|---|---|
| Common | is set, is not set, has value, has no value |
| Strings | equals, does not equal, in, not in, contains, does not contain |
| Numbers | equal to, in between, less than, greater than |
| Booleans | s true, is false |
| Dates | more than, less than, matches range, matches current day, matches current month, matches current year, month matches, day matches, second matches, minute matches, hour matches, year matches, weekday matches |
| Lists | any items, all items |
Payload example
{
"customer_ids": {
"registered": "00020296-5ead-46e1-a249-f2471ecf5a83"
},
"attributes": [
{
"type": "recommendation",
"id": "60d1b3714d56b91380cbef1a",
"fillWithRandom": false,
"size": 10
}
]
}
{
"results": [
{
"success": true,
"value": [
{
"engine_name": "custom_1624355680",
"field_date": 1695765600.0,
"field_number": 1122,
"field_text": "Lorem impsum",
"item_id": "1000",
"product_id": "1000",
"recommendation_id": "60d1b3714d56b91380cbef1a",
"recommendation_source": "model_non_personalized",
"recommendation_variant_id": null
},
{
"engine_name": "custom_1624355680",
"field_date": 1695938400.0,
"field_number": 1124,
"field_text": "Lorem impsum",
"item_id": "1002",
"product_id": "1002",
"recommendation_id": "60d1b3714d56b91380cbef1a",
"recommendation_source": "model_non_personalized",
"recommendation_variant_id": null
},
{
"engine_name": "custom_1624355680",
"field_date": 1696456800.0,
"field_number": 1130,
"field_text": "Lorem impsum",
"item_id": "1008",
"product_id": "1008",
"recommendation_id": "60d1b3714d56b91380cbef1a",
"recommendation_source": "model_non_personalized",
"recommendation_variant_id": null
}
]
}
],
"success": true
}
{
"results": [
{
"error": "No permission",
"success": false
}
],
"success": true
}
