page of results. To do that, you have to specify the desired page of results using one of the parameters
that enable you to return result pages.
To page through results
• Use the appropriate paging parameter in the request. Operations have their own paging parameters.
For example, the following
ItemSearch
request uses ItemPage to ask for the fourth page of results.
http://webservices.amazon.com/onca/xml?
Service=AWSECommerceService&
AWSAccessKeyId=
[AWS Access Key ID]
&
Operation=ItemSearch&
Keywords=Potter&
SearchIndex=Books&
ItemPage=4
&Timestamp=[YYYY-MM-DDThh:mm:ssZ]
&Signature=[Request Signature]
The following snippet of the response shows that the fourth page of results has been returned.
<ItemSearchRequest>
<ItemPage>4</ItemPage>
<Keywords>Potter</Keywords>
<SearchIndex>Books</SearchIndex>
</ItemSearchRequest>
</Request>
<TotalResults>9729</TotalResults> <TotalPages>973</TotalPages>
This example shows that 9729 items matched the search criteria. Also, it shows that those results are on
973 (~9729/10) pages. You might try putting in an ItemPage value over 10. If you do, Product Advertising
API returns the following error.
<Error>
<Code>AWS.ParameterOutOfRange</Code>
<Message>The value you specified for ItemPage is invalid. Valid values must
be between 1 and 10.</Message>
</Error>
So, how do you get that 973rd page? You cannot. A better approach is to submit a new request that is
more targeted and yields fewer items in the response.
Maximum Number Of Returned Pages
The last example showed that Product Advertising API returns only so many pages for any one request.
This is because performance must be optimized for the tens of thousands of Product Advertising API
developers and customers. For that reason, many Product Advertising API operations have pagination
parameters and associated maximum values, as shown in the following table.
Maximum Page Number
Parameter Name
Operation
150
VariationPage
ItemLookup
20
ReviewPage
ItemLookup
10
ItemPage
ItemSearch
API Version 2011-08-01
82
Product Advertising API Developer Guide
Paging and Sorting Through Responses