The above command returns a 200 Success response on success.
You can try out an autocomplete query on your dataset by typing the following URL into a web browser:
https://ac.cnstrc.com/autocomplete/[query]?key=[your API key], replacing
[query] with the query you'd like to make, and
[your API key] with your API key.
Want to try it right now? You can search for
labrador from our demo list of dog breeds here.
GET https://ac.cnstrc.com/autocomplete/[query]?key=[your API key]
|query||Yes||The URL-encoded autocomplete query.|
|key||Yes||The key for the autocomplete you would like to query.|
|num_results||No||The number of results to return across all sections in the autocomplete (rounded down if |
|numresults[section_name]||No||The number of results to return from autocomplete section |
|filters||No||A filter to be applied to autocomplete requests, so that only results that have that filter are returned. You can use facets or group_ids as filters. Autosuggest calls allow a maximum of one filter to be applied.|
Constructor.io's autocomplete returns easy-to-process JSON responses.
Autocomplete responses are returned in discrete sections. Most typically there will be two such sections:
Search Suggestions. The purpose of these is as follows:
ProductsThese are the items you sell and want to facilitate discovery for. Constructor's autosuggest allows users to jump right to the product they're interested in within milliseconds -- even with millions of catalog items.
Search SuggestionsThese are suggested search terms users can choose to search. Suggested search terms help users discover your catalog and better qualify their search by encouraging more specific, well-formed queries. Customers can generate and maintain Search Suggestions themselves, but most customers rely on Constructor's optimization and suggestion alogorithms to generate and optimize the list of search suggestions.
These are the typical sections, but we also support suggesting category page results, store locations, etc. You can work with our Implementation Engineering team to define and optimize other entities you'd like to search within.
Within each autocomplete response JSON, we include data on the submitted request.
Values with a default as well as the autocompleted term will always be returned. Otherwise, only given parameters will be returned within the request data.
We intentionally omit the following parameters from the response request object for privacy reasons: key, c, i, ui, s, _dt
Example: For the query 'https://ac.cnstrc.com/autocomplete/bird%20food?key=[your_key]' we might get the following request info:
All autosuggest responses will include at least two fields:
matched_termsThis indicates the terms that were matched within each item returned and is useful for implementing highlighting of match values. In the example to the right, imagine the user has typed
doge food, Constructor resolves this to the spell corrected
dog foodand returns the matched terms to permit match highilighting even for misspellings.
valueThis is the primary field searched and displayed to the user and generally correponds to
item_nameyou provided when adding the item.
Search Suggestions and Products response structures are broadly similar, but reviewing them individually is helpful as certain fields are more common or bear different significance depending on their location.
One of the most important roles of autosuggest is to clarify ambiguous queries. By leveraging Constructor's category suggestions, we can help users clarify their intent. Users often make over-broad searches like
shirts which may be men's or women's shirts or juniors shirts.
in Women's Clothing
in Men's Clothing
in Juniors' Clothing
Each Search Suggestion is returned with a
data array containing Constructor's ordered recommendations for group suggestions.
The contents of this array are configurable, but most often include the following fields:
display_nameThe name you would like displayed for the group in question.
group_idAn alphanumeric identifier your company uses to uniquely identify the particular group entity.
pathThe hierarchy of
group_ids within which the group exists. In the example to the right,
95would be the parent
Products are typically the main items a company is interested in promoting so typically have the most metadata associated with them.
In addition to the
matched_terms always returned, Constructor can display any data that's been uploaded for the items in question, which is returned in a
data object. We'll go over a typical subset below:
Additional Data (may not be present)
data.urlThe URL where the item can be viewed or purchased.
data.idAn ID that uniquely identifies the item within the company.
data.image_urlAn image of the item in question.
data.groupsThe category(ies) an item belongs to. We'll review these in greater detail below.
data.facetsThe facet(s) an item is associated with. We'll review these in greater detail below.
The autocomplete response format for product data matches the search response format.