Autocomplete Search

How to use Autocomplete Search API

The API provides an autocomplete endpoint. This allows you to perform full text search on your asset’s localizedNames.

Depending on the parameters of your query, the API will respond with a list of predictions based on similarity in all the localizedNnames you provided for your assets.

The user’s input should be set into the parameter query using the field localized. For the sample below we searched the string commercial, with the parameter language set to it.

{
    "predictions": [
        {
            "store_id": "CI341",
            "name": "Centro Commerciale Deria",
            "types": [
                "CI"
            ],
            "matched_substrings": [
                {
                    "offset": 7,
                    "length": 10
                }
            ],
            "highlighted": "Centro <b>Commercial</b>e Deria"
        },
        ...
        ]
}

The name property of the predictions will be filled with the localized name of your asset in the language you provided in your query if it exists, or else the default name property.

The response includes some useful informations for your front-end rendering like the highlighted property which returns an HTML formated string with, if it exists, the matched substring(s) in bold font.

The offset and the length of the matched substring(s) are also available in the list provided on matched_substrings property.

And of course the response contains the store_id property which you can use to retrieve full data (like coordinates, address, opening hours…) using our classic Search API.

The field localized of the Search Query is only available on the Autocomplete API endpoint and not on the S earch endpoint. You can use every field available in a Search Query on both endpoints. The full text search is only available on the localizedNames property. Searching using name or city will only returns perfect matches.

You can find a request sample here.