News for hackers. Stuff that matters.
Re:Paginating Requests in APIs (2020) by amelius on Saturday May 28, 2022 @01:46PM (#31542250)
> There is no way to skip pages. If the user wants page X, it needs to request pages from 1 to X.

Huh? The client can ask the server to generate a new cursor, any desired amount of items ahead in the list.

Re:Paginating Requests in APIs (2020) by mypalmike on Saturday May 28, 2022 @02:18PM (#31542486)
With opaque cursors, how does a client specify "a desired amount"?
Re:Paginating Requests in APIs (2020) by amelius on Saturday May 28, 2022 @02:22PM (#31542513)
You just say "this cursor + 5 pages", for example.
Re:Paginating Requests in APIs (2020) by hombre_fatal on Saturday May 28, 2022 @03:06PM (#31542820)
You send `GET /items[?cursor=<cursor>]` to my server.

I respond:

    [
        "items": [ {...}, {...}, {...}, ... ],
        "next_cursor": "77963b7a"
    ]
How do you request "this cursor + 5 pages"?
Re:Paginating Requests in APIs (2020) by amelius on Saturday May 28, 2022 @03:24PM (#31542958)
GET /items?cursor=77963b7a&add_to_cursor=5pages
Re:Paginating Requests in APIs (2020) by ignaciochiazzo on Tuesday May 31, 2022 @11:42PM (#31577792)
I strongly suggest not doing this since the application will be implementing `offset` in that scenario. This is the same as having Page-based pagination but with a cursor that acts a filter/sorting blob.
Re:Paginating Requests in APIs (2020) by dingleberry420 on Saturday May 28, 2022 @01:48PM (#31542268)
If the server supports this, which they won't, because they don't want to support pagination.