Sorting Results
The following Product Advertising API operations have a Sort parameter that arranges results:
-
ItemSearch
-
ListLookup
-
SellerListingSearch
To Sort Results
-
Consult the appendix, APPNDX_SortValuesArticle Sort Values, to determine available sort values.
Available sort values vary by locale and search index.
-
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
A small snippet of the response shows that the book titles are returned in alphabetical order.
<Title>Aventuras de Harry Potter, Las</Title> ... <Title>Beacham's Sourcebook For Teaching Young Adult Fiction: Exploring Harry Potter</Title> ... <Title>Beatrix Potter to Harry Potter: Portraits of Children's Writers</Title>
Product Advertising API 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.