Pagination

1 min read

Upbooks API – Pagination #

Upbooks APIs support pagination for list responses to efficiently handle large datasets. Pagination is achieved by using the `pageNo` and `pageSize` headers in your GET requests along with other necessary headers.

Pagination Headers #

Include the following headers in your GET requests to enable pagination:

Authorization: Bearer YOUR_JWT_TOKEN
Organization-ID: YOUR_ORGANIZATION_ID
API-KEY: YOUR_API_KEY
pageNo: 1
pageSize: 10

The `pageNo` represents the page number, and `pageSize` represents the number of items to include per page.

Example: Client List API #

For the “Client List” API, you can use pagination headers as follows:

GET https://api.upbooks.io/api/v1/clients
Headers:
Authorization: Bearer YOUR_JWT_TOKEN
Organization-ID: YOUR_ORGANIZATION_ID
API-KEY: YOUR_API_KEY
pageNo: 1
pageSize: 20

This request fetches the first page of 20 clients. Adjust the `pageNo` and `pageSize` headers to navigate through the list.

Pagination Response #

The API response will include information about pagination, such as:

"data": [{"clientId": "123", "name": "Client 1"}, {"clientId": "456", "name": "Client 2"}],
"totalCount": 50,
"filteredCount": 20,
"message": "Clients retrieved successfully"

The `totalCount` represents the total number of items available, and `filteredCount` represents the number of items in the current page.

Adjusting Pagination #

Modify the `pageNo` and `pageSize` headers to navigate through different pages and control the number of items per page based on your application’s requirements.