Firstbase API
  • INTRODUCTION
    • REST API
    • Use Cases
      • User Management
      • Asset Management
      • Catalog and Ordering
  • GETTING STARTED
    • Generating your API Key
    • Authentication
    • Making requests
    • Pagination
    • Rate Limiting
    • Deprecations - WIP
    • Filtering - WIP
  • API Reference
    • Catalog
      • Skus
    • Inventory
      • Tags
      • Assignment
      • Archive
    • Orders
    • Shipments
    • Packages
    • Users
    • Specification
Powered by GitBook
On this page
  1. GETTING STARTED

Pagination

How to paginate through the records.

To efficiently manage large datasets, most of our API endpoints support pagination. When requesting lists of records, you can control the number of results returned per page and navigate through the available pages of data.

Parameters

  • page (optional). Specifies the page number to retrieve. Pages are 1-based, meaning the first page is 1.

  • size (optional). Defines the number of records returned per page defaulting to 100.

Response Metadata

Each paginated response includes metadata in the response body that helps you navigate through the results:

  • totalRecords. The total number of records available.

  • totalPages.The total number of pages available based on the current page size.

  • currentPage. The current page number.

  • pageSize. The number of records returned per page (matching the size parameter).

Example

GET /api/inventory?page=2&size=50
{
  "data": [
    { "inventoryId": "abc123", "name": "MacBook Pro", "status": "Available" },
    { "inventoryId": "def456", "name": "Dell XPS", "status": "Deployed" }
  ],
  "pagination": {
    "totalRecords": 200,
    "totalPages": 4,
    "currentPage": 2,
    "pageSize": 50
  }
}

Fetching all records

To retrieve all records, you’ll need to paginate through the results by incrementing the page parameter in successive requests until the last page is reached. Each response will contain the totalPages value to indicate the total number of pages available.

PreviousMaking requestsNextRate Limiting

Last updated 7 months ago