7

On a website I'm building a search for Amazon products. This should display some information on the products I can pick up using their affiliate API. I can look up information on the products using this dependency (which I'm not entirely happy about, because I should probably create my own package from their provided WSDL), but I'm not entirely sure what would be the best way to implement an autocomplete in a searchbox for their products.

I want to load the autocomplete information from my own server rather than one of Amazon's, but I am not certain what the recommended way to do this would be. Through the provided Amazon affiliate API or is there a better way?

As a summary, I am looking for a way where I have a textbox with autocompletion on my website, that uses my own server to do the autocompletion (example.com/search/autocomplete/%QUERY%), which should then call some autocompletion functionality on the Amazon API.

Daniel Widdis
  • 8,424
  • 13
  • 41
  • 63
Kristof
  • 1,684
  • 2
  • 23
  • 49

2 Answers2

14

Amazon offers -next to their affiliate API- a webservice which can be used to get their autocomplete information. It can be utilized by calling an URL in the style of:

http://completion.amazon.com/search/complete?search-alias=aps&client=amazon-search-ui&mkt=1&q=canon

Where the contents of q is the query that you want autocompleted.

Kristof
  • 1,684
  • 2
  • 23
  • 49
  • 1
    To give more background on the endpoint, looks like its apart of the Product Advertising API - http://docs.aws.amazon.com/AWSECommerceService/latest/GSG/Welcome.html – pbojinov Nov 28 '16 at 20:38
  • 1
    Any way to narrow this by just the SearchIndex (category)? For example AutoComplete for only Kindle Books? – Gregory R. Dec 13 '16 at 03:20
  • Here is how to add Category paramere in autocomplete API https://completion.amazon.co.uk/api/2017/suggestions?lop=en_IN&mid=A21TJRUUN4KGV&alias=[CATEGORY]&prefix=who – Slick Slime May 26 '19 at 08:32
2

I created a vanilla JavaScript plugin to integrate the Amazon Autocomplete webservice into a search input.

Fortunately, the Amazon webservice is JSONP enabled so it let you handle the requests via <script> tags and callbacks, which is already implemented in the plugin.

https://github.com/caroso1222/amazon-autocomplete

Carlos Roso
  • 1,435
  • 1
  • 11
  • 14