Autosuggest API - Bloomreach Experience - Open Source CMS

Autosuggest API

Example request

Here’s an example API call for an autosuggest query, starting with the single letter, a:

Request

GET http://suggest.dxpapi.com/api/v1/suggest/?
account_id=<Bloomreach Provided Account ID>
&auth_key=jazzhands
&domain_key=example_com
&request_id=7546919099987
&_br_uid_2=uid%3D5917073780329%3A_uid%3D9737480431795%3Av%3D11.8%3Ats%3D1459840113832%3Ahc%3D37
&url=www.example.com
&ref_url=http://www.example.com/
&q=a
&request_type=suggest


Example response

Here's an example JSON response for the autosuggest query:

Response

{
"responseHeader": {
    "status": 0,
    "QTime": 0
},
"response": {
    "q": "a",
    "suggestions": [
        {
            "q": "atlas",
            "dq": "atlas",
            "filters": [
                {
                    "name": "Mountain Bars",
                    "value": "Mountain Bars",
                    "key": "Department"
                },
                {
                    "name": "Cranksets",
                    "value": "Cranksets",
                    "key": "Department"
                }
            ]
        },
        {
            "q": "raceface atlas",
            "dq": "raceface atlas"
        },
        {
            "q": "reynolds attack",
            "dq": "reynolds attack"
        },
        {
            "q": "fox attack q4 short",
            "dq": "fox attack q4 short"
        },
        {
            "q": "atlas handlebar",
            "dq": "atlas handlebar"
        }
    ],
    "numFound": 21
}
}


Suggestions

The list of suggestions in the response is in the response JSON object. The value of the  suggestions  field is an array of suggested queries and associated category suggestions. All queries are in this form:

"q": "suggested query",

"dq": "UI display query"

In the response, q field values are suggested queries and dq field values are display queries. A display query is the suggested query rendered for display in browsers.

Typically, q and dq values are the same. They usually differ when there are special characters in the q value that need to be rendered for your site visitors.

The dq values are relevant for displaying suggested queries in the browser. When your site visitor clicks a suggestion in the browser, that suggestion is the dq value. Upon clicking a suggestion, your site visitor initiates a search API call. That call is formed with the q value, not the dq value. 

Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?