Paginated endpoints are too inconsistent. Be more consistent or improve documentation. #6789
Unanswered
MinnDevelopment
asked this question in
API Feature Requests & Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The API has many paginated endpoints, usually with a subset of these parameters:
before
after
limit
However, the behavior of these endpoints is inconsistent to the point of having to debug each one. This becomes increasingly problematic when endpoints are locked behind monetization or other walls, like with entitlements.
Some of the observed "flavors" of pagination used in the API:
Returns the messages in the same order no matter how you paginate. You have to use the last id for
before
and the first id forafter
.This endpoint reverses the list when you use the
after
parameter. So you always take the last id to continue in either direction. To start pagination, you have to useafter=0
or omit bothbefore
andafter
. Defaulting tobefore
.Uses the
user_id
for pagination and reverses the list if you usebefore
. This endpoint also defaults toafter=0
, unlike most others.This endpoint reverses the list if you use
after
, similar to audit logs.Uses the archive timestamp to paginate instead of an id. Seemingly the only endpoint to tell you if there are more results using
has_more
. This is probably the least consistent endpoint, but at least has good documentation.As a library developer, this level of inconsistency is a major struggle during development. Please be more consistent.
Even the details given in the respective documentation is inconsistent:
Gives clear explanation of how pagination works (which apparently I had to document myself Add note about audit log entry order in pagination #5843)
No details, you have to debug this yourself.
Some details, but not explaining the default order despite being the only one that seems to default to
after=0
! I had to debug this again just for this post.Beta Was this translation helpful? Give feedback.
All reactions