Pagination

Collections return 50 items per page. Follow the next link, or increment page, until there is none.

How it works

Collections are paginated with a page query parameter, starting at 1. Each page holds up to 50 items; the page size is fixed and cannot be raised with a parameter.

Shell
curl "https://api.loupe.ch/api/public/cms-events?organization.slug=riveville&page=2" \  -H "Accept: application/ld+json"

Reading a page

Request JSON-LD to get the total and the links to other pages. The view object only contains the links that exist: there is no next on the last page.

JSON
{  "totalItems": 124,  "member": [ … ],  "view": {    "@id": "/api/public/cms-events?organization.slug=riveville&page=2",    "first": "/api/public/cms-events?organization.slug=riveville&page=1",    "last": "/api/public/cms-events?organization.slug=riveville&page=3",    "previous": "/api/public/cms-events?organization.slug=riveville&page=1",    "next": "/api/public/cms-events?organization.slug=riveville&page=3"  }}

With Accept: application/json, a page is a plain array with no total or links. Keep requesting the next page until you get fewer than 50 items.

Fetching everything

JavaScript
async function fetchAll(path) {  const items = [];  let next = path;  while (next) {    const response = await fetch(`https://api.loupe.ch${next}`, {      headers: { Accept: "application/ld+json" },    });    if (!response.ok) throw new Error(`Loupe API ${response.status}`);    const page = await response.json();    items.push(...page.member);    next = page.view?.next ?? null;  }  return items;}
const events = await fetchAll("/api/public/cms-events?organization.slug=riveville");

Exceptions

A few collections follow different rules:

CollectionBehaviour
Reservations (/api/public/reservations)Up to 1,000 per page, filtered by bookable and dates
Manager reservation list (/api/manager/reservations)25 per page; returns { items, totalItems, page, pageSize }
Maps, zones, translationsNot paginated: the whole list in one response

Catalogue search uses offset and limit (up to 50) in its request body instead; see Catalogue search.