appdotnet / api-spec

App.net API Documentation is on the web at https://developers.app.net. Source for these docs is in the new-docs branch here. Please use the issue tracker and submit pull requests! Help us build the real-time social service where users and developers come first, not advertisers.
https://developers.app.net
950 stars 98 forks source link

'More' flag in response.meta is ambiguous #162

Closed dquick-freelance closed 12 years ago

dquick-freelance commented 12 years ago

While integrating the response_envelope migration into one of my apps, I've come to realize that response.meta.more is ambiguous for requests made without specifying a before_id or since_id.

For instance, calling GET https://alpha-api.app.net/stream/0/posts/stream/global?count=200 will return the 200 newest posts, a min_id and max_id, and more=true. Does that mean that there are newer ones than I requested, or older?

Logically, I know that there are both (probably, since I can't guarantee that there's a new post by the time I receive and process the response, but it's likely, and more likely by the day). But programmatically, there's no way to easily differentiate which "end" of the feed has more objects fitting the criteria based on the response envelope.

Would it make sense to migrate the more flag to two separate flags or counts? For example:

response = {
    meta: {
      code: 200,
      max_id: 288391,
      min_id: 288192,
      newer: 0,
      older: 288191
   },
   data: {
      [...]
   }
}

Would that make more sense, or am I just being dumb about something?

mattflaschen commented 12 years ago

I think it's always older, since the order is always descending (earlier later in response). I think it basically queries for an extra row that is not returned, but if the row is present more is true.

dquick-freelance commented 12 years ago

Ok, I'll buy that for a dollar. I'll close the issue and move along. Thanks for the clarification! :)