Pagination

🚧

In develoment

This feature is still in development.

Status :

  • All API endpoints that return a list already use the data model described below, the elements of the page being under the "data" key of the returned payload.
  • However, at the moment they return all the elements of the list. The pagination is not activated yet.

Pagination is a feature in Defacto endpoints that return more results than can be returned in a single response. In the event that this happens, data is returned in a series of 'pages'. Pagination refers to methods for programmatically requesting all of the pages, in order to retrieve the entire result data set.

Cursor-based Pagination

Defacto utilises a cursor-based pagination. As a user, you will first send a request to Defacto specifying a page size limit as shown below.

Example initial request

https://api.getdefacto.com/loans?page_size=100

Defacto will then serve a response with the data up to the specified page size limit, in addition to the link to the next page (which contains the cursor in the query parameters). Further subsequent requests made to the Defacto API will then send a specified page limit size and the cursor as shown below.

Example paginated response

{
  "data": [ "<listing data here>" ],
  "count": 20,
  "page_size": 100,
  "next_page": "/loans?page_size=100&cursor=1504224000000_10"
}

Example subsequent request

https://api.getdefacto.com/loans?page_size=100&cursor=1504224000000_10

The Defacto server will use these cursors to make efficient queries so as to prevent reading duplicate data before serving this back to you as a response.