Amazon Music Web API
Web API Pagination V1.0
Pagination
Many Web API endpoints allow pagination of their results. Endpoints that allow pagination will offer a limit
parameter as well as a token
/cursor
parameter. The default page size is 100 for most endpoints (where the page size is different, the documentation will note it). To specify a different size, include the query parameter limit
with your request. The limit
parameter must be a number between 1 and 100, inclusive.
Results will be returned with a PageInfo object. PageInfo
has the properties hasNextPage
and token
. If PageInfo.hasNextPage
is true
, then there is at least one additional page of results. PageInfo.token
can be used to retrieve those results.
The following is an example of how to handle paginated results: suppose you make a request to the followed artists endpoint:
<base url>/v1/me/followed/artists?limit=1
It may return the following as part of its response:
"pageInfo": {
"hasNextPage": true,
"token": "YUu8B558fNvJ4zG0z8LrD8eocIgTpEvvA7FxEnze..."
},
To request the next page of results, you will need the value of token
, seen above. Send another request to the same endpoint, again with the specified limit
and appending a new query parameter, cursor
. Use the value obtained from pageInfo.token
above. For example, like the following request:
<base url>/v1/me/followed/artists?limit=1&cursor=YUu8B558fNvJ4zG0z8LrD8eocIgTpEvvA7FxEnze...
This will return the next page of results. If there is another page after that, pageInfo.hasNextPage
will be true
and there will be a new token
. Repeat the process for each page.