Getting basic recommendations
The most basic request for recommendations is to send Sitecore Search an empty recommendations.content
object. This gets recommendations based on what an administrator configured in Search, in the recipe of the recommendation widget.
For the complete data model, see the Search and Recommendation API reference.
Here's a sample request to get 5 recommendations for the content entity:
RequestResponse
{
"context": {
"locale": "en-us",
"page": {
"uri": "/content/Using-fresh-flowers-to -decorate"
}
},
"source": "12345",
"widget": {
"items": [
{
"entity": "content",
"rfk_id": "rfkid_1",
"recommendations": {
"content": {},
"limit": 5
}
}
]
}
}
Here's a sample response:
RequestResponse
{
"widgets": [
{
"rfk_id": "rfkid_2000",
"type": "recommendation",
"used_in": "page",
"entity": "content",
"content": [
{
"title": "Decorating Your Home with Fragrances",
"description": "Discover ways to make your home smell wonderful with our guide to using room sprays, diffusers, and scented candles.",
"image_url": "//assets.example.com/content/decorating_your_home_with_fragrances.jpg",
"content_url": "/content/decorating-your-home-with-fragrances",
"author": "Jane Doe",
"publication_date": "2024-04-01",
"category": "Home Decor"
},
{
"title": "The Benefits of Aromatherapy",
"description": "Learn about the benefits of aromatherapy and how different scents can improve your health and mood.",
"image_url": "//assets.example.com/content/benefits_of_aromatherapy.jpg",
"content_url": "/content/benefits-of-aromatherapy",
"author": "John Smith",
"publication_date": "2024-03-15",
"category": "Wellness"
}
...
],
"total_item": 5,
"limit": 5,
"offset": 0
}
],
"dt": 133,
"ts": 1714507825540
}