Made with Palestinian hands Support EmuPath ☕

No results found.

Try another search or remove some filters.

WORKED LEARNING GUIDE

Read Every API Page Without Duplicate Work

Design cursor pagination, bounded retries and safe progress tracking for an API import.

Before you start: Read JSON and HTTP status codes

The scenario

A fictional API has 245 inventory records and returns 100 records with a next cursor. The importer reads one response and announces success because HTTP status is 200. The request worked, but the import is incomplete.

1. Follow the contract

Treat cursors as opaque unless the provider specifies otherwise. Continue to the documented terminal condition, not merely a short page unless that is the contract. Save progress only after processing succeeds. An empty page with a continuation token can still require another request.

2. Account for changing data

Use a documented snapshot or stable ordering when available. Otherwise select a deduplication key and state the consistency limits. A repeated cursor should cause a bounded failure rather than an infinite loop. Test empty results, missing fields and repeated records separately.

3. Bound retries

Follow provider retry guidance and Retry-After where applicable. Repeating a read and repeating a creation request have different consequences; use documented idempotency support for state-changing operations. Keep server credentials out of frontend code. CORS permission does not turn a secret key into public information.

HTTP 200 includes a next cursor. Is the import complete?

Practice with EmuPath

Check the primary reference

Examples are educational scenarios. Verify the current documentation and your own environment before changing a real system.

Explore another lesson