Autosuggest API - Bloomreach Experience - Open Source CMS

Autosuggest API

Example request

Here’s an example API call for an autosuggest query, starting with the letters "sa":

Request

GET http://suggest.dxpapi.com/api/v2/suggest/?
account_id=<Bloomreach Provided Account ID>
&auth_key=jazzhands
&request_id=7546919099987
&catalog_views=product:store1|recipe:daily
&_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=sa
&request_type=suggest


Example response

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

Response

{
  "queryContext": {
    "originalQuery": "sa"
  },
  "suggestionGroups": [
    {
      "catalogName": "products",
      "view": "store1",
      "searchSuggestions": [
        {
            "url": "https://www.example.com/us/shop/catalog/product/salsa_sauce/2000306000?_br_psugg_q=sauce",
            "sale_price": 12.9,
            "pid": "2000000000",
            "thumb_image": "https://www.example.com/images/1_front_000/00300011-01.jpg",
            "title": "Mexican Salsa Sauce"
        }
      ],
      "querySuggestions": [
        {
            "query": "salsa sauce",
            "displayText": "Salsa sauce"
        }
      ],
      "attributeSuggestions": [ {            
                "value": "/sauce,sauce/salsa_sauce,salsa_sauce",
                "name": "/sauce,sauce/salsa_sauce,salsa_sauce",
                "attributeType": "category"
            }
      ]
    },
    {
        "catalogName" : "recipe",
        "view" : "daily",
        "querySuggestions" : [
            {
             "query": "Spicy salsa sauce"
             "displayText": "spicy salsa sauce",
             
            },
            {
              "query": "salsa sauce",
              "displayText": "Salsa sauce"
            }
        ]
    }
  ]
}

Response Entities

The Autosuggest API has the following basic entities in the response: 

Parameter 

Description

Example

queryContext

The metadata of the API call that provides context to the query. This can consist of parameters such as originalQuery.

{
    "originalQuery": "sa"
  },
 

suggestionGroups

 

 

 

 

 

 

 

 

 

 

 

 

 

     

 

    

Content suggestion items for every catalog view pair.

a. catalogName: The catalog name is the name of the item. 

b. View: The view of the element inside the catalog and being queried for.

c. searchSuggestions: Search Suggestion contains search documents. Currently, it can only be supported for catalog_name=product.

d. querySuggestions:Query suggestion items which are filtered from the Bloomreach dictionaries. Contains objects of: 

  • query - Query stored inside dictionaries.
  • displayText - Display text for the query.

e. attributeSuggestions(RHS suggestions): Suggestions corresponding to different attributes(facets). Currently supported for catalog_name=products.



 

product/recipes/news/articles.

Suggestions

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

"query": "suggested query",

"displayText": "UI display query"

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

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

The displayText values are relevant for displaying suggested queries in the browser. When your site visitor clicks a suggestion in the browser, that suggestion is the displayText value. Upon clicking a suggestion, your site visitor initiates a search API call. That call is formed with the query value, not the displayText 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?