News for hackers. Stuff that matters.
Re:Paginating Requests in APIs (2020) by robertlagrant on Saturday May 28, 2022 @03:32PM (#31543037)
What are you saying that would be different in practice? What advantages would it have?
Re:Paginating Requests in APIs (2020) by jayd16 on Saturday May 28, 2022 @03:48PM (#31543154)
Not sure I agree with the parent but thinking it through, you have a single connection and a cleaner life cycle. Streaming writes and reads could mean back-pressure is possible. A client can consume items as needed as opposed to mapping usage to a page size.

There's no worry about wasting a full request on the last page with a single item. In fact there's no worry about round trips at all, it's just a matter of buffer back pressure that communicates the need for more or less.

Hmm, when you think about it, its a pretty good way to go.

Re:Paginating Requests in APIs (2020) by User23 on Saturday May 28, 2022 @04:38PM (#31543597)
That’s consistent with what I have in mind. I too think it’s pretty much best of both worlds. You get better efficiency than pagination with the convenience of an API that’s no different from fetching all the data.
Re:Paginating Requests in APIs (2020) by nerdponx on Saturday May 28, 2022 @04:45PM (#31543663)
I worked with an API like this once, which streamed NDJSON one line at a time. I loved the amount of control that it gave me on the client side!