Blog

Tutorial: Amazon.com Search API

Posted on
Sorting Results

To Sort Results

  1. Consult the Sort Values Appendix to determine available sort values.Available sort values vary by locale and search index.
  2. Add the Sort parameter to a request that uses one of the preceding operations.

For example, the following request returns books with “Harry Potter” in their title or description in alphabetical order.

http://ecs.amazonaws.com/onca/xml?
Service=AWSECommerceService&
AWSAccessKeyId=1MEXAMPLEZBG2&
Operation=ItemSearch&
Keywords=Harry%20Potter&
SearchIndex=Books&
Sort=titlerank&
ItemPage=29&
Version=2006-09-13

Amazon Associates Web Service provides many different sorting criteria, for example, price (high to low, or low to high), salesrank (best to worst selling, or worst to best selling), publication date, review rank, and release date. Valid sort parameters vary by search index, for example, the DigitalMusic search index can be sorted by UploadedDate. That value for Sort would not make sense in the Automotive search index, for example. Sort parameters also differ by locale. For more information about sort values by locale and search index, see the appendix, ItemSearch Sort Values By Locale. Default Sort Values There are many sort values. The majority are not applied unless the Sortparameter is included in the request. There are two sort values, however, that are used by default.

  • For ItemSearch requests that do not use the BrowseNode parameter, results are sorted by Relevance
  • For ItemSearch requests that do use the BrowseNode parameter, results are sorted by BestSeller ranking