Recommend API Guide
The Recommend API can be used to return recommendations for a given placement. A placement should be configured in the back office (or via API) and the placement key noted - this should be used to request results.
Placements - Generating Recommendations
The placement endpoint can be used to generate recommendations for a given placement:
POST https://api.graphyte.ai/recommend/v1/placements/{placementKey}/recommendations
Headers:
x-api-key=api key given at integration
x-brand-key=unique reference for brand
content-type=application/json
A typical request would capture key information about the context of the request:
{
"context": {
"product": "Gaming",
"category": "Slots",
"page": {
"url": "casino.graphytecasino.com/en",
"title": "Slots page"
},
"channel": "Mobile"
},
"userId": "123456",
"traits": {
"contextId": "440q6fneh3k-0jot24y2k-76umam8"
},
"type": "recommendation"
}
And would return a set of items such as the following:
{
"recommendation": {
"result": [
{
"game": {
"game_code": "gameiomslingorainbowriches",
"score": 0.6708955335834027,
"rank": 1
}
},
...
],
"recId": "1326e3b1-0ecc-4baf-9714-ff2ad4f1ebab",
"recDateTime": "2020-02-26T21:08:57.767Z",
"explanation": {
"reason": "tagged games",
"tag_type": "portlet",
"tag": "MOST POPULAR"
}
}
}
Sports example
Request payload:
{
"context": {
"product": "Sports",
"category": "Football",
"page": {
"url": "sport.graphyte.ai",
"title": "Football"
}
},
"recommendation": {
"target": {
"exclusions": {
"inBetSlip": false,
"additionalItemList": [
832831914
]
}
}
},
"userId": "1",
"type": "recommendation"
}
exclusions - this dictionary allows you to add extra rules to limit recommendation output. inBetSlip flag must be set to True if recommendation is displayed on the betslip. additionalItemListshould contain a list of selections that are already added by the user to his basket(bet slip). This list would allow Opti-X engine to build a list of events that should be restricted for current recommendation request and any selection from that events will be excluded from the recommendation output.
Example response:
{
"recommendation": {
"result": [
{
"selection": {
"selectionKey": 1196055705,
"selectionName": "Brighton",
"marketName": "Match Betting",
"eventName": "Fulham vs Brighton",
"eventKey": "231649173",
"eventDateTime": "2020-12-16T20:00:00Z",
"typeName": "Premier League",
"className": "English",
"categoryName": "Football",
"denPrice": 4,
"numPrice": 6,
"selectionPriceType": "LP",
"decPrice": 2.5,
"minsToOff": 205,
"score": 0.6222013974969091,
"user_key": "1",
"rank": 1
}
}
],
"recId": "d3df0134-9262-4c8d-9241-ab56043fe7f0",
"recDateTime": "2020-12-16T16:34:00.376Z"
}
}
Open API Specification
Full API specification is available within the Developer Tools section of the back office.
Updated 3 months ago