Frontend API | Add redirects for search phrase suggestions

Redirects can be triggered when a user enters a specific search term on your website. With Tweakwise’s autocomplete feature, your users get suggestions for search phrases while they’re typing. Sometimes there is a suggested search phrase that would result in a redirect. However, previously you would first have to do a navigation search or products request to know if there was a redirect for the chosen search phrase.

With the addition of adding redirects directly in the response for search phrase suggestions, we’ve removed the need for a separate call. This means your users can get redirected immediately instead of having to wait for an extra request, speeding up the user experience.

<!--This is an example of a XML response for a suggestions call-->
<suggestionGroups xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <group>
    <name>Suggestions</name>
    <type>SearchPhrase</type>
    <suggestions>
      <suggestion>
        <match>Apple</match>
        <navigationLink>
          <path><![CDATA[/navigation-search/e4894213?tn_q=Apple]]></path>
          <context>
            <searchterm>Apple</searchterm>
          </context>
        </navigationLink>
        <redirects> <!--The new redirects node-->
          <redirect>
            <url>https://tweakwise.com</url>
          </redirect>
        </redirects>
      </suggestion>
    </suggestions>
  </group>
</suggestionGroups>
// This is an example of a JSON response for a suggestions call
[
    {
        "name": "Suggestions",
        "type": "SearchPhrase",
        "suggestions": [
            {
                "match": "Apple",
                "navigationLink": {
                    "path": "/navigation-search/tweakwise?tn_q=Apple",
                    "context": {
                        "searchterm": "Apple"
                    }
                },
                "redirects": [ // The new redirects object
                    {
                        "url": "https://tweakwise.com"
                    }
                ]
            }
        ]
    }
]

The following endpoints have been affected by the change: