hongminhee ,
@hongminhee@todon.eu avatar

The max_id, since_id, and min_id parameters in #Mastodon's Timeline API assume that the post ID is a sortable number. (Is this correct?) #Hollo, the #ActivityPub implementation I'm building, uses UUIDs for post IDs internally, so I'm stuck on how to implement a Mastodon-compatible API.

https://docs.joinmastodon.org/methods/timelines/

#fedidev

julian ,
@julian@fietkau.social avatar

@hongminhee Does it assume that? I don't see it clearly stated in the documentation that the IDs themselves need to be numerically sortable, just that, when given a specific ID, the server needs to be able to retrieve newer or older posts based on it.

Of course sortable snowflake IDs make implementing this easier on the server side.

hongminhee OP ,
@hongminhee@todon.eu avatar

@julian According to @thisismissem, Mastodon uses Snowflake for ID generation.

thisismissem ,
@thisismissem@hachyderm.io avatar

@hongminhee @julian correct, those parameters just say "newer / older than this ID", so you totally could fetch the object from the database and using like created at timestamps, but time-ordered unique IDs simplifies that for feeds & pagination by ID/cursor

thisismissem ,
@thisismissem@hachyderm.io avatar

@hongminhee @julian keep in mind, you can totally not implement those parameters though, as it's all based on the next/prev Link headers, not URL construction necessarily

The only case is if clients for some reason try to make requests explicitly by constructing URLs instead of relying on headers

hongminhee OP ,
@hongminhee@todon.eu avatar

@thisismissem Oh, I hadn't noticed that Mastodon's Timeline API comes with a Link header. Thanks for pointing that out!

thisismissem ,
@thisismissem@hachyderm.io avatar

@hongminhee yup, if memory serves, that's how dansup side-stepped this in Pixelfed

dansup ,
@dansup@mastodon.social avatar
  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • test
  • worldmews
  • mews
  • All magazines