Event Connectors

Paginate a Result Set

Walk through multi-page results using page and size parameters

The GET /events endpoint (and other list endpoints) supports pagination via the size parameter. The maximum page size is 5000 records.

Basic Pagination

Use size to control how many results are returned per request. To walk through pages, combine size with an offset or page-based approach depending on your needs.

# First page: 20 results
curl -H "Authorization: Bearer YOUR_API_TOKEN" \
  "https://app.eventconnectors.nl/api/events?size=20&published=true"
async function fetchEvents(page, pageSize = 20) {
  const params = new URLSearchParams({
    size: String(pageSize),
    published: "true",
  });

  const response = await fetch(
    `https://app.eventconnectors.nl/api/events?${params}`,
    { headers: { Authorization: "Bearer YOUR_API_TOKEN" } }
  );

  return response.json();
}

// Fetch the first page
const firstPage = await fetchEvents(1);

Walking Through All Results

To iterate through all events, fetch pages until you receive fewer results than your page size:

# Page through with size parameter
# Adjust sortField to ensure consistent ordering
curl -H "Authorization: Bearer YOUR_API_TOKEN" \
  "https://app.eventconnectors.nl/api/events?size=100&sortField=lastupdated&sortOrder=DESC&published=true"
async function fetchAllEvents(pageSize = 100) {
  const allEvents = [];
  let lastUpdated = null;

  while (true) {
    const params = new URLSearchParams({
      size: String(pageSize),
      sortField: "lastupdated",
      sortOrder: "DESC",
      published: "true",
    });

    if (lastUpdated) {
      params.set("lastupdated", lastUpdated);
    }

    const response = await fetch(
      `https://app.eventconnectors.nl/api/events?${params}`,
      { headers: { Authorization: "Bearer YOUR_API_TOKEN" } }
    );

    const events = await response.json();
    if (!Array.isArray(events) || events.length === 0) break;

    allEvents.push(...events);

    if (events.length < pageSize) break;

    // Use the last event's timestamp for the next page
    lastUpdated = events[events.length - 1].lastupdated;
  }

  return allEvents;
}

Sorting

Use sortField and sortOrder to control result ordering:

ParameterValuesDefault
sortFieldAny root-level field (e.g., lastupdated, creationdate, title)lastupdated
sortOrderASC, DESCDESC

Consistent sorting is important for reliable pagination — always specify a sort field when paginating.

See the API Reference for the full list of query parameters.

On this page