logo
  • Community
  • Support
  • Sign up
  • What is Sesam Hub
    • Key benefits
    • Core principles
    • Concepts
    • Data architecture
    • Demo
  • Features
    • Data Management
      • Automatic Reprocessing
      • Namespaces
      • Merging
      • Global datasets
      • Dependency Tracking
      • Schema Inference
      • Schema Models
      • Integrated Search
      • Property Lineage
      • Completeness
      • Compaction
      • Config Groups
    • Data Synchronization
      • Scheduling and Signalling
      • Change Tracking
      • Extensions
      • Continuation Support
      • Deletion Tracking
      • Circuit breakers
      • Transit Encoding
      • Webhooks
      • Connectors
    • Operations
      • VPN
      • Durable Data
      • Notifications
      • Metrics and monitoring
      • Bring your own key
      • Network Policy
      • Status Page
      • Software Channels
  • Documentation
    • Building blocks
      • Streams of entities
      • Datasets
      • Systems
      • Pipes
      • Flows
      • Environment Variables
      • Secrets
      • Service Metadata
    • Data management
      • Patterns
        • Enrich patterns
          • Extract foreign references as extracted datatypes pattern
          • Adding type information pattern
          • Splitting out lists of sub-objects pattern
          • Normalising data pattern
          • Extract reference properties as reference/classification entities
        • Connect patterns
          • Cleaning data pattern
          • External merge pattern
          • Golden property based on priority pattern
          • Golden property based on last updated pattern
          • Golden property based on quality
          • Feedback loop pattern
          • Hungarian notation references pattern
        • Transform patterns
          • Late schema binding
          • Defining hierarchies for recursion
          • Re-mapping references to target identifiers
        • Generic patterns
          • Open to extension closed for modification
          • Rewriting identity pattern
      • Data management
      • Time-based masterdata management
      • Entity Data Model
    • Data platforms
      • Sesam in Microsoft Azure
      • Sesam in Google Cloud Platform
    • Data synchronization
      • API Best Practices
      • Bi-directional synchronization
      • Connectors
        • The Connector Contract
        • Connector configurations
          • The manifest
          • The templates
          • The config.json file
        • Available connectors
          • Asana
          • Bamboo HR
          • Business Central
          • Chargebee
          • CRMOffice
          • DBpedia
          • Difi
          • Exact Online
          • Freshteam
          • HubSpot
          • Invoiced
          • Keap
          • Membercare
          • Monday.com
          • PowerOffice GO
          • Sage
          • Shopify
          • SSB
          • Squarespace
          • SuperOffice
          • Tidsbanken
          • Trello
          • Tripletex
          • Twelve Data
          • Uni Economy
          • Wave
          • webCRM
          • Wikidata
          • Wix
          • WooCommerce
          • Xledger
          • YouTrack
          • Zendesk
          • Zoho CRM
        • Using connectors
      • Cron Expressions
      • Developer Extension Points
        • Custom Data Sources
        • Custom Data Transforms
        • Custom Data Sinks
        • Microservices in Sesam
      • JSON Pull Protocol
      • JSON Push Protocol
      • Non-idempotency
      • Patterns
        • Collect Patterns
          • Authentication schemes pattern
          • Avoid unnecessary load on source systems pattern
          • Claims pattern
          • Combine -all and -event pattern
          • Continuation pattern
          • Datatype naming pattern
          • Datatypes follow the api pattern
          • Datatypes with list of linked-objects pattern
          • Establish origin pattern
          • Handling asymmetry pattern
          • Keep data in original structure pattern
          • Make periodic entities from a versioned history pattern
          • Pagination pattern
          • Parameterized datatypes pattern
          • Receive webhook events pattern
          • Recreate best effort history from a source pattern
          • Register webhook pattern
          • Source that only provides delta streams pattern
          • Source with since support but no deletions pattern
          • Source with parameterized input pattern
          • Sporadic empty response pattern
          • Synthetic properties pattern
          • Two step collect pattern
          • Use templates pattern
          • Verify deletes pattern
          • Webhook deletion tracking pattern
        • Transform Patterns
          • Namespace split pattern
        • Share Patterns
          • Capture response with transform pattern
          • Delete pattern
          • Duplicate hops block
          • Exposing data pattern
          • External reference pattern
          • Handling asymmetry
          • Insert pattern
          • Optimistic locking pattern
          • Single share pattern
          • Share template extension points pattern
          • Update pattern
          • Use datatype specific operations pattern
      • RDF Support
      • Source Datatype Mapping
    • Data Transformation Language (DTL)
      • Introduction
      • Annotated Example
      • Built-in Variables
      • Path Expressions and Hops
      • How joins work
      • Namespace aware functions
      • Caveats
      • DTL: Transforms
      • DTL: Boolean logic
      • DTL: Booleans
      • DTL: Bytes
      • DTL: Comparisons
      • DTL: Conditionals
      • DTL: Date and time
      • DTL: Dictionaries
      • DTL: Encryption
      • DTL: Hops
      • DTL: JSON
      • DTL: Lists
      • DTL: Math
      • DTL: Misc
      • DTL: Namespaced identifiers
      • DTL: Nulls
      • DTL: Numbers
      • DTL: Phonenumbers
      • DTL: Sets
      • DTL: Strings
      • DTL: URIs
      • DTL: UUIDs
      • Argument types
      • Supported Timezones
    • Deprecated features
      • Databrowser
        • Databrowser Guide
        • Authentication and authorization
        • Configuration file API
      • GDPR platform
        • Getting started
        • Platform configuration
        • Datatypes and purposes configuration
        • The GDPR data access portal
        • Developer documentation
        • Changelog
      • Management Console
        • Authentication
        • Configuration
    • Discontinued services
      • Sesam Talk
        • Supported systems
          • Business Central
          • Hubspot
          • Poweroffice
          • SuperOffice
          • Tidsbanken
          • Tripletex
          • Wave
          • Wix
        • Concepts
          • Selective data sync
          • Merging
          • Co-existing with other integration services
          • Counting updates
          • Re-authorisation
        • Enhanced Data Security
        • Becoming a partner
        • Service Level Objective
        • Background
        • Help
      • Open Sesam
    • Enhanced data security
    • Operations
      • Security
      • Metrics and monitoring
      • Pump Execution Dataset
      • Configuration Management
        • Using Sesam with a version control system
        • Testing a Sesam configuration locally
        • Continuous integration
        • Automatic deployment
      • Self-hosted service
      • Self-hosted on Kubernetes
      • Debugging
      • Behind the scenes
      • Troubleshooting
    • Project kickstart
      • Planning a project
      • Setting up an environment
      • Creating a dataflow
    • Quick Reference
    • Service API
    • Service Configuration
      • General
      • Environment variables
      • Service metadata
      • Pipes
        • Sources
          • Binary source
          • Conditional source
          • CSV source
          • Dataset source
          • Embedded source
          • Empty source
          • HTTP endpoint source
          • JSON source
          • LDAP source
          • Merge source
          • Merge datasets source
          • RDF source
          • REST source
          • SDShare source
          • SPARQL source
          • SQL source
          • Union datasets source
        • Transforms
          • Conditional transform
          • DTL transform
          • Emit children transform
          • HTTP transform
          • JSON Schema validation transform
          • RDF transform
          • REST transform
          • Template transform
          • XML transform
        • Sinks
          • Conditional sink
          • CSV endpoint sink
          • Dataset sink
          • Elasticsearch sink
          • Email Message sink
          • HTTP endpoint sink
          • JSON push sink
          • Null sink
          • REST sink
          • SDShare push sink
          • SMS message sink
          • Solr sink
          • SPARQL sink
          • SQL sink
          • XML endpoint sink
        • Pumps
      • Systems
        • Elasticsearch system
        • LDAP system
        • Legacy Microsoft SQL Server system
        • Microservice system
        • Microsoft SQL Server system
        • MySQL system
        • Oracle system
        • Oracle TNS system
        • PostgreSQL system
        • REST system
        • SMTP system
        • SQL systems
        • Solr system
        • Twilio system
        • URL system
    • Tools
      • Management Studio
      • Sesam Client
      • Connector Tools
  • Learn
    • Sesam Training Course
    • Working in Sesam Projects
    • Getting started
      • Sign up
      • Create your first synchronization
        • Data Synchronization
          • Collect
          • Share
        • Data Management
          • Enrich
          • Connect
          • Transform
    • Data synchronization
      • Customize Extension Points
        • How to Customize Data Sources
          • The Microservice system
          • Microservices & Continuation support
  • Pricing
  • Service Level Agreement
  • Roadmap
  • Changelog
On this page
  • Key concepts
  • Pagination patterns
  • Implementing pagination in a connector
  • Example: system config with pagination
  • Example: system config with pagination (incrementing parameter)
  1. Home
  2. Documentation
  3. Synchronization
  4. Data Synchronization Patterns
  5. Collect Patterns
  6. Pagination

Pagination¶

Pagination in an API is a technique used to split large sets of data into smaller, manageable chunks. Instead of returning all data in one response (which can be slow and resource intensive), the API delivers it in “pages,” making the responses faster and easier to handle reducing the load on the API server.

Key concepts¶

Key concepts in pagination:

  1. Page Size (Limit): Specifies the number of records per page.
    • Example: ?limit=10 (returns 10 records).

  2. Page Number/Offset: Indicates which page of data you’re requesting.
    • Example: ?page=2 (fetches the second page).

    • Or ?offset=10&limit=10 (fetches the next set of 10 records, starting from record 11).

  3. Next/Previous Links: APIs often return links to the next page to simplify navigation including a token to use in the next API call.
    • Based on the API this information might be included in the response header or body or none of them. for example, Shopify includes this information in the response header but HubSpot includes it in the response body. but webCRM does not return back page info.

Pagination patterns¶

There are two common pagination patterns:

  1. Offset-based pagination: Uses an offset to specify the starting point of the data set.
    • Example: ?offset=10&limit=10 (fetches the next set of 10 records, starting from record 11).

  2. Cursor-based pagination: Uses a cursor to specify the starting point of the data set.
    • Example: ?cursor=eyJpZCI6IjEw

    • The cursor is a unique identifier for a specific record in the data set. The API uses this identifier to fetch the next set of records.

Implementing pagination in a connector¶

When building a connector, it’s headeressential to implement pagination correctly. Here are some best practices:

  1. Use the page size (limit) parameter to control the number of records per page.
    • define "page_size": <page_size>, in the system configuration. page_size of 100 is a common default.

  2. Use the page or offset parameter to specify which page of data you’re requesting. update url in system configuration:
    • Example: "url": "https://api.example.com/v1/data?limit={{page_size}}"

  3. Include next link in the response to simplify navigation. Update next_page_link in system configuration:
    • Use Jinja conditional statements to check if the next link is available.

    • Example: "next_page_link": "{%if (headers.link.next is defined)%}{{headers.link.next}}{%endif%}"

    • Some APIs don’t return back next page link (e.g. webCRM). In this case you might need to use previous API call parameters to retrieve next page (depends on how the API supports it)

  4. Implement termination conditions to stop fetching data when there are no more pages.
    • Example: "next_page_termination_strategy": ["next-page-link-empty", "empty-result", "not-full-page"]

Example: system config with pagination¶

"<datatype>-list": {
   "id_expression": "{{ <primary_key> }}",
   "method": "GET",
   "next_page_link": "{%if (headers.link.next is defined)%}{{headers.link.next}}{%endif%}",
   "next_page_termination_strategy": [
     "next-page-link-empty"
   ],
   "page_size": 100,
   "url": "https://api.example.com/v1/data?limit={{page_size}}"
 }

A full connector example of pagination support could be found in Shopify connector’s playground branch in the System config.

Example: system config with pagination (incrementing parameter)¶

"<datatype>-list": {
   "id_expression": "<primary_key>",
   "method": "GET",
   "next_page_link": "<query_endpoint>",
   "next_page_termination_strategy": [
     "next-page-link-empty"
   ],
   "params": {
     "Page": "{% if previous_params.Page is not defined %}1{% else %}{{ previous_params.Page|int+1|int }}{% endif %}",
     "Size": 100
   },
   "url": "https://api.example.com/v1/data?limit={{page_size}}"
 }

A full connector example of pagination support (with incrementing parameter) could be found in webCRM connector’s playground branch in the System config.

previous

Make periodic entities from a versioned history pattern

next

Parameterized datatypes

    Legal | Terms of service

© Copyright 2025 Bouvet ASA.

    Certified ISO 27001