Skip to main content

Fetch recommendations [POST]

POST /recommend

Retrieves recommendations for the userId provided as parameter.

Headers

ApiKey:string - (Required) Engine ApiKey

Body

userId:string - (Required) BiskoId of the user.

currentItemId:string - (Optional) Id of the item user is currently reading.

domain:string - (Optional) Current domain that the user is visiting.

page:int - (Optional) Page number (0 based)

size:int - (Required) Number of articles per page

diversification:boolean - (Optional, default true)

pageToken:string - (Optional for first page, Required on following pages)

filters:object - (Optional) Object defining filtering of the items

Filter object

operator:string - (Required) and|or

conditions:object[] - (Required) Array of FilterConditions

Filter conditions

propertyName:string - (Required) [ItemId, Title, Url, ImageUrl, PublishDate, Locked, Category, Domain]

operator:string - (Required) Options depend on propertyName data type.

  • string
    • =
    • !=
    • contains
    • notContains
    • startsWith
    • endsWith
  • number
    • =
    • !=
    • >
    • >=
    • <
    • <=
  • date
    • =
    • !=
    • >
    • <
    • last (example values [12-Hours, 7-Days, 4-Weeks, 3-Months, 1-Years])

values:string[] - (Required)

Example request

curl -v 'https://{engine-name}.gjirafa.ai/recommend' \
-H 'ApiKey:{api_key}' \
-X 'POST'
-d '{
"page": 0,
"userId": "{userId}",
"size": 2,
"diversification": true,
"filter": {
"operator": "and",
"conditions": [
{
"propertyName": "Domain",
"operator": "=",
"value": "www.example.com"
}
]
}
}'

Example response

{
"items": [
{
"itemId": "1",
"domain": "www.example.com",
"title": "Example Article 1",
"category": null,
"url": "https://www.example.com/article-1",
"imageUrl": "https://cdn.example.com/article-1",
"publishDate": "2022-09-15T09:45:00+00:00",
"locked": "False",
"hasVideo": null,
"requestId": "5497b0f1-0551-4dd2-826f-7f581c931477",
},
{
"itemId": "2",
"domain": "www.example.com",
"title": "Example Article 2",
"category": null,
"url": "https://www.example.com/article-2",
"imageUrl": "https://cdn.example.com/article-2",
"publishDate": "2022-09-15T09:45:00+00:00",
"locked": "True",
"hasVideo": "False",
"requestId": "5497b0f1-0551-4dd2-826f-7f581c931477",
}
],
"pageToken": "2a463502-ca5e-4df5-94dd-8d852d477ed7",
"totalSize": 14,
"totalPages": 7,
"hasNextPage": true,
"requstId": "5497b0f1-0551-4dd2-826f-7f581c931477"
}