Project

General

Profile

Actions

Feature #1598

closed

API: Offset Pagination

Added by Andreas Olschnögger over 2 years ago. Updated over 2 years 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
Actions #1

Updated by Bernhard Koschiček-Krombholz over 2 years ago

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

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?

Actions #2

Updated by Bernhard Koschiček-Krombholz over 2 years ago

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

Updated by Andreas Olschnögger over 2 years 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.

Actions #4

Updated by Bernhard Koschiček-Krombholz over 2 years ago

  • Status changed from Acknowledged to Closed
  • Target version changed from 208 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.

Actions

Also available in: Atom PDF