Project

General

Profile

Feature #1598

API: Offset Pagination

Added by Andreas Olschnögger 2 months ago. Updated about 1 month ago.

Status:
Closed
Priority:
Normal
Category:
API
Target version:
Start date:
2021-11-08
Estimated time:

Description

It would be good to have something like an offset pagination to the current variant, so that pages further behind can be accessed correctly without first making a request to the first page.
For example:
  • ?limit=20 will return first page
  • ?limit=20&offset=20 will return second page
  • ?limit=20&offset=40 will return third page
  • and so on

History

#1

Updated by Bernhard Koschiček-Krombholz 2 months ago

  • Tracker changed from Question to Feature
  • Status changed from New to Acknowledged
  • Assignee set to Bernhard Koschiček-Krombholz
  • Target version set to API

We/I choose the Keyset/Cursor Pagination, because it is know as best practice at the moment and quite robust. (Good overview about that: https://nordicapis.com/everything-you-need-to-know-about-api-pagination/ and https://ignaciochiazzo.medium.com/paginating-requests-in-apis-d4883d4c1c4c)

I can implement offset pagination. But I also can give you the option to directly jump to a page, like ?page=5&limit=100. I think this looks better, especially for the users (as I concluded, from what you said, it is also for the user, that they can copy a link with the page information). If the page does not exist, it will show the last page of the request.

Would the page solution suits you?

#2

Updated by Bernhard Koschiček-Krombholz 2 months ago

  • Subject changed from Offset Pagination to API: Offset Pagination
#3

Updated by Andreas Olschnögger 2 months ago

Bernhard Koschiček-Krombholz wrote:

We/I choose the Keyset/Cursor Pagination, because it is know as best practice at the moment and quite robust. (Good overview about that: https://nordicapis.com/everything-you-need-to-know-about-api-pagination/ and https://ignaciochiazzo.medium.com/paginating-requests-in-apis-d4883d4c1c4c)

I can implement offset pagination. But I also can give you the option to directly jump to a page, like ?page=5&limit=100. I think this looks better, especially for the users (as I concluded, from what you said, it is also for the user, that they can copy a link with the page information). If the page does not exist, it will show the last page of the request.

Would the page solution suits you?

Yes, this sounds good to me.

#4

Updated by Bernhard Koschiček-Krombholz about 1 month ago

  • Status changed from Acknowledged to Closed
  • Target version changed from API to 7.0.0

Sorry for the delay. It is done for 0.2 and 0.3.

Usage ?page=5, then you come to the page 5 of the given query. If you use last and first with page, page will overwrite first and last. It is usable together with limit. Remember, limit is by default 20.

Also available in: Atom PDF