Integration
Pagination & caching
Traverse complete snapshots and refresh them without losing removal events.
Treat cursors as opaque#
List responses contain data plus page.hasMore and page.nextCursor. Send nextCursor unchanged as the cursor parameter. Preserve the original filters across pages. Do not decode or manufacture cursor values.
# First page, then pass page.nextCursor back unchanged
curl "$COLLECTALES_BASE_URL/v1/games/one-piece/cards?limit=100" \
--header "authorization: Bearer $COLLECTALES_ACCESS_TOKEN"
curl "$COLLECTALES_BASE_URL/v1/games/one-piece/cards?limit=100&cursor=$NEXT_CURSOR" \
--header "authorization: Bearer $COLLECTALES_ACCESS_TOKEN"const all = [];
let cursor;
do {
const url = new URL(`${base}/v1/games/one-piece/cards`);
url.searchParams.set("limit", "100");
if (cursor) url.searchParams.set("cursor", cursor);
const response = await fetch(url, { headers: { authorization: `Bearer ${access_token}` } });
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const { data, page } = await response.json();
all.push(...data);
cursor = page.hasMore ? page.nextCursor : undefined;
} while (cursor);
// Replace your local snapshot only now that every page succeeded.rows, cursor = [], None
while True:
params = {"limit": 100, **({"cursor": cursor} if cursor else {})}
response = requests.get(
f"{base}/v1/games/one-piece/cards",
headers={"authorization": f"Bearer {access_token}"},
params=params,
timeout=10,
)
response.raise_for_status()
body = response.json()
rows.extend(body["data"])
if not body["page"]["hasMore"]:
break
cursor = body["page"]["nextCursor"]
# Replace your local snapshot only now that every page succeeded.Commit a complete local snapshot#
Stage incoming pages in a temporary dataset. Publish the new local snapshot only after every page succeeds. On failure, retain the previous complete snapshot and retry later.
Handle removals explicitly#
updated_after filters currently visible rows. Deleted, archived, or rights-withdrawn rows can disappear without a tombstone. A periodic full reconciliation is required. Deletion-safe incremental synchronization is not available.