Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
273 lines (203 sloc) 7.55 KB

Pagination

Fetching all objects of a resource can be convenient. At the same time, returning too many objects at once can be unpractical from a performance perspective. Doing so might be too much work for the Mollie API to generate, or for your website to process. The maximum number of objects returned is 250.

For this reason the Mollie API only returns a subset of the requested set of objects. In other words, the Mollie API chops the result of a certain API method call into pages you're able to programmatically scroll through.

Pagination in v2 API endpoints

The v2 API endpoints use the so-called cursor pagination method. In short, this ensures the objects in a page do not get shifted when a new object is created with the same account in the meantime, by paginating by object ID rather than by page number.

Response object

count

.. type:: integer

The number of objects found in _embedded, which is either the requested number (with a maximum of 250) or the default number.

_embedded

.. type:: object

The actual data you're looking for.

_links

.. type:: object

Links to help navigate through the lists of objects. Every URL object will contain an href and a type field.

self

.. type:: object

The URL to the current set of objects.

previous

.. type:: object

The previous set of objects, if available.

next

.. type:: object

The next set of objects, if available.

documentation

.. type:: object

The URL to the current list endpoint documentation.

Example of v2 pagination

Request

Response

Pagination in v1 API endpoints

Warning

This is the documentation of the v1 API. The documentation for pagination in the new v2 API can be found above. For more information on the v2 API, refer to our :doc:`v2 migration guide </payments/migrating-v1-to-v2>`.

Using the count parameter you can set the page size up to a maximum of 250 objects. The result will be paginated accordingly, presuming your request would otherwise have resulted in more than count objects. The offset parameter lets you skip a certain number of objects before your page starts.

In order to enable you to easily page through the result, every response links to the next, the previous, the first and the last page. The following overview lists all response fields:

Response object

totalCount

.. type:: integer

The total number of objects available.

offset

.. type:: integer

The number of skipped objects as requested.

count

.. type:: integer

The number of objects found in data, which is either the requested number (with a maximum of 250) or the default number.

data

.. type:: array

The actual data you're looking for.

links

.. type:: object

Links to help navigate through the lists of objects, based on the given offset.

previous

.. type:: string

The previous set of objects, if available.

next

.. type:: string

The next set of objects, if available.

first

.. type:: string

The first set of objects, if available.

last

.. type:: string

The last set of objects, if available.

Example of v1 pagination

Request

Response