Pagination

In this guide, we will look at how to work with paginated responses when querying the Feedier API. By default, all responses limit results to ten. However, you can go as high as 100 by adding a limit parameter to your requests.

When an API response returns a list of objects, no matter the amount, pagination is supported. In paginated responses, objects are nested in a data attribute and have a meta attribute that indicates you all the necessary information about the pages. You can use the page query parameters to select a specific page.

Example using pages

In this example, we request the page 3 with 30 elements in the page. As a result, we get a list of 30 items and you can find all the necessary information about the pagination in "meta".

  • Name
    page
    Type
    integer
    Description

    The number of the page you want to see.

  • Name
    limit
    Type
    integer
    Description

    Limit the number of items returned per page.

Manual pagination using cURL

curl -G https://api.bx.feedier.com/v3/reports \
  -H "Authorization: Bearer {token}" \
  -d page=3 \
  -d limit=30

Paginated response

  {
      "data": [
          {
              "id": 250,
              "user_id": null,
              "team_id": 1,
              "segment_id": null,
              "name": "Unnamed report",
              "type": "public",
              "status": "published",
              "fql": "[{\"TimePeriod\": {\"$eq\": \"date_last_month\", \"$type\": \"and\"}}]",
              "color": null,
              "created_at": "2024-04-25T11:17:17.000000Z",
              "updated_at": "2024-04-25T11:17:20.000000Z"
          },
          {
              "id": 251,
              // ...
          },
      ],
      "links": {
          "first": "https://api.bx.feedier.com/v3/reports?page=1",
          "last": "https://api.bx.feedier.com/v3/reports?page=2",
          "prev": null,
          "next": "https://api.bx.feedier.com/v3/reports?page=2"
      },
      "meta": {
          "current_page": 1,
          "from": 1,
          "last_page": 2,
          "links": [
              {
                  "url": null,
                  "label": "« Previous",
                  "active": false
              },
                  // ...
          ],
          "path": "https://api.bx.feedier.com/v3/reports",
          "per_page": 10,
          "to": 10,
          "total": 15
      }
  }

Was this page helpful?