Pagination in the API is handled via the Link header standard. Here is a pagination example using this API endpoint:
https://docs.sentry.io/api/events/list-an-issues-events/
The first HTTP request in this example is GET <https://sentry.io/api/0/issues/123456/events/
> .
This returns 100 events for the issue and has the following link header in the response:
<https://sentry.io/api/0/issues/123456/events/?&cursor=0:0:1>; rel="previous"; results="false"; cursor="0:0:1", <https://sentry.io/api/0/issues/123456/events/?&cursor=0:100:0>; rel="next"; results="true"; cursor="0:100:0"
One of the URLs in the link response has rel=next
. This indicates the next results page, and it also has results=true
which means that there are more results.
Based on this, the next request is GET <https://sentry.io/api/0/issues/123456/events/?&cursor=0:100:0
>.
This request will return the next 100 events for that issue, with again the following link header:
<https://sentry.io/api/0/issues/123456/events/?&cursor=0:0:1>; rel="previous"; results="true"; cursor="0:0:1", <https://sentry.io/api/0/issues/123456/events/?&cursor=0:200:0>; rel="next"; results="true"; cursor="0:200:0"
The process is repeated until the URL with rel=next
has the flag results=false
to indicate the last page.