API Reference

GET /v1/recommendations/index/{index public key}/block/{block id}

Retrieve recommendations from an AddSearch Recommend block. See the documentation on configuring recommendations block in the AddSearch dashboard here.

Optional Query Parameters

ParameterDescriptionTypeNotes
itemIdThe id of an item for which recommendations are fetchedstringThe if of the currently viewed item is usually extracted from the page's source code with a CSS selector. If you use docid to identify the item, it could be calculated as md5 hash of the item's URL.

Requests examples

When fetching global recommendations, you don’t need to specify any of the optional parameters. Recommendations are fetched according to the configuration of your global widget block. For instance, a global recommendations request’s URL could look like this:
https://api.addsearch.com/v1/recommendations/index/cfa10522e4ae6987c390ab72e9393908/block/8ddb0998-e38d-4e36-aaaa-214ca49c77bc

When you fetch recommendations for a particular item, you need to specify that item’s id and the path to an id. Here is an example of such request:
https://api.addsearch.com/v1/recommendations/index/cfa10522e4ae6987c390ab72e9393908/block/8ddb0998-e38d-4e36-bbbb-214ca49c77bc?itemId=nf5b7d8nd3325232c485ab72e9376234

Response

The request returns results according to the configuration of your AddSearch Recommend block. For more information on the results object please visit the search API reference page.

Was this helpful?

Need more help?

We’re always happy to help with code or other questions you might have. Search our documentation, contact support, or connect with our sales team.