Pagination not working as expected

Hi!

I’ve been trying to paginate through Sentry’s events API to no avail. I can’t seem to grok how the next/previous Link headers are arranged. Similarly, I also can’t figure out how the pagination works in the web interface.

There are 554 events my issue (#3833). Each time I paginate (left, right – it doesn’t seem to matter), there seem to always be 100 events displayed. I would expect the last page to only have 54 events. Furthermore, after paging to the end in one direction, a different cursor is used when paging back in the other direction (i.e., clicking the right arrow twice uses cursors A and then B, and then clicking the left arrow twice uses cursors B2 and then A2).

In more detail:

  1. I load the events for issue 3833. 100 events are loaded and there’s no cursor in the URL.
  2. I click the right arrow. 100 events are loaded and this cursor is used: 1517955743000:0:0
  3. I click the right arrow again. 91 events are loaded, and this cursor is used: 1517952068000:0:0. At this point the right arrow is greyed out and I can only click the left arrow to go back now. So I’ve seen 291 of my 554 events and have seemingly gotten to the end of paginating. I would expect that I should be able to keep clicking the right arrow until all 554 events have been displayed.
  4. I click the left arrow now to go back. 100 events are loaded, and this cursor is used: 1517952068000:0:1.
  5. I click the left arrow again. 100 events are loaded and this cursor is used: 1517955743000:0:1. Now the left arrow is greyed out (i.e., I’ve gone to the end and back) and a total of 491 out of the issue’s 554 events have been loaded.

Is this working as expected? If so, any help in understanding how this works would be greatly appreciated. The reason it’s important for me to understand this/get it working is because I need to download the 554 events. Thanks!