GET DEMO Chat

 

 

Add an Ecommerce Search Suggestion Box

This is the second in a series of “How To” posts that illustrate the various ways in which you can use the Indix Product API.

We’ve been following along with fictional developers Christy and Ted as they build features into their ecommerce shopping app. After Christy and Ted high-fived each other for their first working feature, query-based product search, Christy breathed in deeply and paused.

“Okay, query search is good…yet the average Joe could get the search term wrong. And he’ll blame our app when he gets the wrong results.”

“So true. Amazon’s search suggestion feature makes my life MUCH easier. How do we build something like that?” asked Ted.

This is the kind of search experience they were going for:

search_suggestions

To make the magic happen as a user types into the search box, the app simply queries the Indix Product API’s Search Suggestions endpoint. When the user clicks on one of the products, they will then hit any one of the Indix API endpoints depending on the depth of product information needed, and the kind of ecommerce experience you want to offer.

Query: https://api.indix.com/v2/products/suggestions?countryCode=US&q=nike&app_key=<enter_app_key>

Sample response:

 {
  "message": "ok",
  "result": {
    "suggestions": [
      {
        "suggestion": "nike"
      },
      {
        "suggestion": "nike s"
      },
      {
        "suggestion": "nike men"
      },
      {
        "suggestion": "nike men s"
      },
      {
        "suggestion": "nike women"
      },
      {
        "suggestion": "nike air"
      },
      {
        "suggestion": "nike women s"
      },
      {
        "suggestion": "nike fit"
      },
      {
        "suggestion": "nike dri"
      },
      {
        "suggestion": "nike max"
      },
      {
        "suggestion": "nike dri fit"
      },
      {
        "suggestion": "nike t"
      },
      {
        "suggestion": "nike air max"
      },
      {
        "suggestion": "nike nfl"
      },
      {
        "suggestion": "nike air men"
      },
... Truncated for brevity

Voila! Done.
Stay tuned as Ted and Christy further tweak their app, like limiting search results to a single store. See you back here soon.

  Download the Pervasive Commerce White Paper
Get API Walk-Through

Leave a Reply

Your email address will not be published. Required fields are marked *