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

Marker Request API #239

Closed natestedman closed 11 years ago

natestedman commented 11 years ago

I may be wrong about the expected use case for markers, but here goes:

  1. Request a collection, typically the unified or basic stream, and receive a marker name alongside it. Store this in your app.
  2. When the user finishes scrolling, or deactivates your app, or ... POST to the marker update endpoint with the id of the object that is currently at the top of the screen.

So, that's for writing to the marker. Right now, using it on the reading end seems a little less optimal.

  1. Do a request with count=0 to retrieve the marker name and the marker's current id.
  2. Use this info to set up a request with before_id set to the id.
  3. Refresh data with before_idafter that page loads to get newer posts.

Two problems here:

  1. This requires two requests. More of an issue on mobile where latency is annoying.
  2. The case of the user scrolling to the newest post in his or her stream. Because before_id is not inclusive (and the inclusive API is deprecated), there's no way to POST an id and include that post the next time the stream is loaded.

My proposed solution:

  1. A parameter allowing a developer to specify a marker name. This name will be used to load the first post returned.
  2. A parameter allowing a developer to specify that the endpoint's "native" marker name should be used. Since the spec doesn't mandate that marker names should not change, I'm uncomfortable storing them client side in case they do change server side.
mthurman commented 11 years ago

We just rolled out special pagination parameters for since/before_id that should help with that: http://developers.app.net/docs/resources/post/#special-pagination-ids. You can now specify either marker or marker_inclusive depending on whether you want to include the marked post.

The other thing to comment on is that all stream markers names are provided by the server (you can't set a marker with a custom name). I think this takes care of everything above, but feel free to reopen if I missed something in the original issue.