Paging

A list that can be long, such as fixtures, comes back one page at a time:

{ "items": [ ... ], "nextCursor": "eyJ2IjoxLCJza2lwIjo1MCwiZiI6..." }

nextCursor is null on the last page. There is no total count.

Parameters

ParameterMeaning
limitItems per page, 1 to 100. Default 50. Outside that range is 400 invalid_request.
cursorPass the previous response's nextCursor, exactly as given.

To get the next page, send the same filters with cursor set:

# page 1
curl "https://api.lovebowls.co.uk/v1/clubs/CLUB_ID/fixtures?kind=match&limit=20" -H "X-Api-Key: $LB_KEY"

# page 2: the same filters, plus the cursor from page 1
curl "https://api.lovebowls.co.uk/v1/clubs/CLUB_ID/fixtures?kind=match&limit=20&cursor=CURSOR_FROM_PAGE_1" \
  -H "X-Api-Key: $LB_KEY"

Rules for cursors

Walking every page

With the SDK, iterateFixtures does it for you. It takes the same filters as listFixtures, with limit as the page size and no cursor, and fetches pages as you read:

import { LovebowlsClient } from "@lovebowls/api";

const lb = new LovebowlsClient({ apiKey: process.env.LB_KEY });

for await (const fixture of lb.iterateFixtures("CLUB_ID", { kind: "match", limit: 50 })) {
  console.log(fixture.start, fixture.opponent);
}

Or by hand, with listFixtures:

let cursor;
do {
  const page = await lb.listFixtures("CLUB_ID", { kind: "match", cursor });
  for (const fixture of page.items) console.log(fixture.start, fixture.opponent);
  cursor = page.nextCursor ?? undefined;
} while (cursor);

Each page is one request against your rate limit. A season of fixtures is a handful of pages at most; use a larger limit rather than many small pages.

Lists that are not paged

listCompetitions returns every competition in one response ({ "items": [...] }, no nextCursor): a club has tens, not thousands.