Page MenuHomewrite.as

Allow pagination of posts
Open, NormalPublic

Description

Overview

All endpoints that return a list of posts should support optional pagination. With page number and optional number of posts per page.

Background

Many people are using the API in custom applications, like showing some posts on another website of theirs. They currently must take the entire list of posts, which for some users may be from a few hundred to over a thousand. Ideally they could select a number of their latest posts and walk through 'pages' of the results with subsequent API calls.

Aside from this some pages, like the drafts page, can be slow when the user has a lot of posts in that collection.

Users

This would affect more advanced users but also speed things up on the write.as front for regular users as well.

Implementation

On routes:

  • GET /api/collections/{COLLECTION_ALIAS}/posts
  • GET /api/me/posts

Add two new query parameters, p or page for page number and l or limit for the number of posts per 'page'.

Both parameters should be optional to retain backwards compatibility.

If the page parameter is provided without the limit parameter, then the limit should default to something sane, like 50.

Revisions and Commits

Event Timeline

robjloranger changed the task status from Open to Idea.Sep 25 2019, 5:57 PM
robjloranger created this task.
robjloranger renamed this task from Allow pagination of collection posts to Allow pagination of posts.Sep 25 2019, 5:58 PM
robjloranger updated the task description. (Show Details)Sep 25 2019, 6:13 PM
matt changed the task status from Idea to Open.Jan 5 2020, 10:43 PM
matt claimed this task.

Partially implementing this as part of my work on T401: Post list paging and T714: Improve core navigation.

matt added a commit: Restricted Diffusion Commit.Jan 5 2020, 11:12 PM