Nxsys API Documentation
  1. Introduction
Nxsys API Documentation
  • Introduction
    • Nxsys API Documentation
    • Base URL and Environments
    • Handling Errors
    • Pagination
    • Best Practices
  • Authentication
    • Overview
    • Step 1: Create a Client Application
    • Step 2: Obtain Authorization Code
    • Step 3: Exchange your Authorization Code for an Access Token
    • Step 4: Refresh your Access Token
  • APIs
    • Authentication
      • Construct the Authorization URL
      • Exchange your Authorization Code for an Access Token
    • Candidates
      • Create Candidate
      • Get Candidates
      • Update Candidate
    • VAT Codes
      • Get Default VAT Codes
    • PaymentRate
      • Create Payment Rate
      • Get Payment Rates
      • Get Single Payment Rate
      • Update Payment Rate
    • Timesheet
      • Create Timesheet
      • Get Timesheets
      • Get Single Timesheet
      • Update Timesheet
    • Payslips
      • Get Payslips
  1. Introduction

Pagination

Overview#

The Nxsys API implements pagination to efficiently manage large datasets, allowing you to retrieve data in manageable chunks. This guide explains how to work with paginated responses to streamline your integration with Nxsys.

Pagination Parameters#

When making requests to endpoints that return lists of items, use the following query parameters to control pagination:
page: The page number to retrieve (default: 1, integer, minimum: 1).
size: The number of items per page (default: 20, maximum: 100, integer).

Example Request#

Response Format#

Paginated responses include the requested data and metadata in the following JSON structure:
{
  "data": [...],
  "meta": {
    "totalDocs": 150,
    "page": 2,
    "size": 50,
    "totalPages": 3
  }
}
Where:
data: An array containing the requested items.
meta.totalDocs: The total number of items available across all pages.
meta.page: The current page number.
meta.size: The number of items per page.
meta.totalPages: The total number of pages based on the size parameter.

Best Practices for Pagination#

Specify size Appropriately: Choose a size value that balances performance and usability, keeping within the maximum limit of 100.
Handle Edge Cases: Check for empty data arrays or totalDocs of 0 to handle cases with no results.
Optimize Requests: Use the meta.totalPages field to avoid requesting non-existent pages.
Implement Error Handling: Account for 400 errors (e.g., invalid page or size) or 429 errors (rate limit exceeded) as described in the Handling Errors section.

Example Usage#

Below is an example of handling pagination in JavaScript/Node.js to fetch all items across multiple pages, including error handling and authentication:
Previous
Handling Errors
Next
Best Practices
Built with