News for hackers. Stuff that matters.
Re:Designing a Pragmatic RESTful API by obelos on Tuesday June 04, 2013 @12:55PM (#5820604)
I prefer providing a "Range" header for pagination. It's typically used for retrieving byte-range chunks of large objects, but it's also applicable to return a subset of a result set, like "Range: records=0-10". This has the drawback of not being easily applied from within a graphical browser, but I don't consider that a big priority for a REST API in the first place. Viva la curl!
Re:Designing a Pragmatic RESTful API by 5avage on Tuesday June 04, 2013 @05:47PM (#5822295)
That's great as long as you're using something with efficient random-access (SQL). If your datastore/back-end is btree-based, however (say, CouchDB for example, or Google search results) you're better off with 'next', 'prev', 'first', etc. pagination. Asking for the 50,000th record means skipping the first 49,999! So, you may be painting your back-end into a corner by counting on random-access being an efficient operation.
Re:Designing a Pragmatic RESTful API by obelos on Tuesday June 04, 2013 @07:53PM (#5822848)
The header's ranges-specifier doesn't specify a syntax, so you can use a docid-based pager just as easily.