News for hackers. Stuff that matters.
Re:JSON API by jeffamcgee on Saturday May 04, 2013 @02:15AM (#5654215)
The twitter API originally used pages, but they realized it was a mistake: https://dev.twitter.com/docs/working-with-timelines . The way the facebook API does it is a lot more sane: http://developers.facebook.com/docs/reference/api/pagination... .

I think that you should specify the format for cursor based paging of resource collections. One way to do it would be to require a url to get more results:

    {
      "posts": [...]
      "meta": {
        "next":"/posts/search?q=baseball&after=1234"
      }
    }
Another option would be for it to be a key/value pair that must be added to the url:

    {
      "posts": [...]
      "meta": {
        "next":"after=1234"
      }
    }
Either way, rest clients should treat it as a meaningless string.
Re:JSON API by steveklabnik on Saturday May 04, 2013 @03:19AM (#5654355)
Currently, we don't say anything about searching. That's really an application-level concern, not something that needs to be in this spec.

(So you'd define your own rels and use them, doesn't affect this level of abstraction.)

Re:JSON API by wycats on Saturday May 04, 2013 @02:36AM (#5654267)
Agreed. If I standardize pagination, I'll be using a "since" token, not pages (this is actually something Ember Data already supports, but weakly).