Pagination

In this guide, we will look at how to work with paginated responses when querying the Featurebase 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 results attribute. You can use the page query parameters to browse pages. You will also get access to totalPages and totalResults, which you can use to build pagination controls in your application.

Example using pages

In this example, we request the second page of posts.

  • Name
    page
    Type
    string
    Description

    The page to return.

  • Name
    limit
    Type
    integer
    Description

    Limit the number of items returned.

Manual pagination using cURL

curl -G https://do.featurebase.app/v2/posts \
  -H "X-API-Key: {token}" \
  -d page=2 \
  -d limit=10

Paginated response

{
    "results": [
        {
            "title": "Weekly email to users.",
            ...
        {
            ...
        },
        ...
    ],
    "page": 2,
    "limit": 10,
    "totalPages": 18,
    "totalResults": 179
}