Pagination

Pagination in Vome API

The Vome API supports navigating through large datasets by implementing cursor-based pagination. This feature allows clients to efficiently browse through lists of resources such as profiles or shift reservations, ensuring that applications can handle large amounts of data smoothly.

How Pagination Works

Pagination in the Vome API relies on two parameters to navigate through data: page and limit. These parameters help control the part of the dataset that the API returns on each request.

Parameters

  • page (integer): Specifies the page number of the results to retrieve.

  • limit (integer, optional, default is 10): Determines the number of records to return in one page. This number can range between 1 and 100, allowing flexibility depending on the needs of the client application.

Example Usage

To navigate through lists of profiles for example, you can utilize the page and limit parameters to fetch data in manageable chunks, as well as other search criteria.

Fetching a specific page of profiles:

GET /api/profiles/search/?first_name=Aaron&is_offline=False&page=2&limit=15

In this example, the API returns the second page of search results where each page contains up to 15 profiles that match the search criteria.

Response Structure

The API response for paginated requests includes metadata along with the actual data to assist in navigation:

{
    "count": 150,
    "next": "https://api.vomevolunteer.com/api/profiles/search/?first_name=Aaron&is_offline=False&page=3&limit=15",
    "previous": "https://api.vomevolunteer.com/api/profiles/search/?first_name=Aaron&is_offline=False&page=1&limit=15",
    "results": [
        {
            "id": "example_id",
            "first_name": "Aaron",
            "last_name": "Smith",
            "is_offline": false,
            ...
        },
        ...
    ]
}
  • Next Page: If available, the next field in the response contains the URL to access the next page of results.

  • Previous Page: Similarly, the previous field provides the URL to go back to the prior page of results.

Last updated