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.

To avoid duplicate items on your page, bucket deduplication processes widgets in the order they appear in the request's widget.items array. The first widget has the highest priority. In each round, each widget selects up to its bucket size, skipping items already selected by higher-priority widgets. Search repeats the process until selection is complete. For a single widget, Search still removes duplicate items from its results.

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:

{
  "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:

{
    "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
}
If you have suggestions for improving this article, let us know!