--- title: Get recommendations slug: '1447' canonical_url: https://docs.coveo.com/en/1447/ collection: build-a-search-ui source_format: adoc --- # Get recommendations The REST Search API allows you to get [Coveo Machine Learning (Coveo ML)](https://docs.coveo.com/en/188/) [content recommendations](https://docs.coveo.com/en/1016/) based on users' action history, such as their recently viewed pages. The pipeline uses these recommendations to change the `advancedExpression` and `rankingExpression` before sending the request to the [index](https://docs.coveo.com/en/204/). ## Examples * [Coveo ML](https://docs.coveo.com/en/188/) response: ```json {"recommendations":[ { "eventType":"url", "name":"PageVisit", "explanations":[], "score":46.20083214759826, "metadata": { "contentType": "Documentation", "contentIdKey": "sfid", "contentIdValue": "kA130000000Pv61CAC", "language":"en", "topValue":"top", "trendingValue":"trending", "title":"Configuring the server" }, "value":"https://mycompany.com/htviewhelpdoc?id=configuring_the_server.htm" } ]} ``` * REST API call to get [content recommendations](https://docs.coveo.com/en/1016/): ```txt https://platform.cloud.coveo.com/rest/search/v2/q=test&actionsHistory=[{"name":"PageView", "value":"https://www.dropbox.com/home/NTO-Manuals/Camping?select=mec-cabin-4.html", "time":"2016-06-03T00:00:00.0000Z"}] ``` Ranking expression in the response block: ```json ... "rankingExpressions" : [ { "expression" : "@urihash=\"vlTp6wQP Z 6wSKF\"", "modifier" : 250, "isConstant" : false }, { "expression" : "@urihash=\"VrulQxaNUFgGzENC\"", "modifier" : 107, "isConstant" : false }, { "expression" : "@urihash=\"cBQGBj1wEoVt9ETR\"", "modifier" : 102, "isConstant" : false }, { "expression" : "@urihash=\"5Ht1bPr4tbQd Ns \"", "modifier" : 95, "isConstant" : false }, { "expression" : "@urihash=\"wKxci395EKjpbIDl\"", "modifier" : 93, "isConstant" : false } ], ... ``` Advanced expression in the response block: ```json ... "advancedExpression" : "@urihash=\"vlTp6wQP Z 6wSKF\" OR @urihash=\"VrulQxaNUFgGzENC\" OR @urihash=\"cBQGBj1wEoVt9ETR\" OR @urihash=\"5Ht1bPr4tbQd Ns \" OR @urihash=\"wKxci395EKjpbIDl\"", ... ``` ## Parameters As this feature is part of a search at REST API, you can call it using all the other parameters. However, you must add the new parameter `actionsHistory`. ### `actionsHistory` The history of the 10 last actions taken by the current user. When using the [Coveo JavaScript Search Framework](https://docs.coveo.com/en/187/), this information will be stored in a [cookie](https://docs.coveo.com/en/mbeg0162/) and sent to the server when the recommendation feature is activated. Each action history must contain a name, value, and time, as in the following example: ```json [{ "name":"PageView", "value":"https://www.dropbox.com/home/NTO-Manuals/Camping?select=mec-cabin-4.html", "time":"2016-06-03T00:00:00.0000Z" }] ``` ### `format` The format of the results. Use `xlsx` for excel and `json` for JSON. By default, the service returns the results in a JSON format.