Skip to content

Pagination

This guide explains how to work with paginated responses when querying the Oxygen Peppol API. By default, most list endpoints return up to fifteen items per page. This approach improves performance and minimizes the amount of data transferred over the network.

The paginated response includes a data attribute that contains the list of items for the current page. The links and meta attributes provide information about the pagination state, including the current page, total number of pages, and navigation links for moving between pages.

Example using page-based pagination

In the following example, the second page of results is requested. The response contains two invoices, and the links.next attribute indicates that there are no additional pages available.

  • Name
    page
    Type
    int
    Description

    The page number to retrieve.

bash
curl -G https://sandbox-peppol.oxygen.gr/api/v1/invoices \
  -H "Authorization: Bearer {token}" \
  -d page=2
json
{
    "data": [
        {
            "id": "",
            "...": "..."
        },
        {
            "id": "",
            "...": "..."
        }
    ],
    "links": {
        "first": "https://sandbox-peppol.oxygen.test/api/v1/invoices?page=1",
        "last": "https://sandbox-peppol.oxygen.test/api/v1/invoices?page=2",
        "prev": "https://sandbox-peppol.oxygen.test/api/v1/invoices?page=1",
        "next": null
      },
      "meta": {
        "current_page": 2,
        "from": 16,
        "last_page": 2,
        "links": [
          {
            "url": "http://peppol.oxygen.test/api/v1/invoices?page=1",
            "label": "« Previous",
            "active": false
          },
          {
            "url": "http://peppol.oxygen.test/api/v1/invoices?page=1",
            "label": "1",
            "active": false
          },
          {
            "url": "http://peppol.oxygen.test/api/v1/invoices?page=2",
            "label": "2",
            "active": true
          },
          {
            "url": null,
            "label": "Next »",
            "active": false
          }
        ],
        "path": "http://peppol.oxygen.test/api/v1/invoices",
        "per_page": 15,
        "to": 17,
        "total": 17
      }
}

Released under the MIT License.