REST API Ingestion, Pagination, Rate Limiting & Retries
Ingest APIs reliably with pagination strategies, backoff on rate limits, and idempotent retries.
In plain words
Endpoint limits, ordering, and idempotency. Next, cursor, bounded page size, and timeout. Finally, deduplicate output, then advance checkpoint.
Think of it like…
Cursor extraction is a bookmark in a changing book; page-number extraction is trying to find your place by counting pages while the librarian keeps inserting new pages.
Where you’ve seen it
Request /orders?cursor=opaque&limit=500; on 429 sleep the Retry-After value, persist next_cursor, and upsert merchant_id/order_id so the same response is safe to process twice.
Words you’ll hear
- Pagination
- A stateless or opaque cursor that identifies the next page even as earlier records change.
- Rate Limits
- Server-imposed request quotas often exposed through 429 responses and
Retry-Afteror remaining-request headers. - Retries
- Re-executing a request or transform without changing the logical output; append-only destinations still need deduplication.
- Operational boundary
- Page-number pagination drifts when source rows are inserted, immediate retries amplify an outage, and retrying an unguarded POST can duplicate side effects. Prefer server cursors or updated-at plus stable tie-breakers, honor
Retry-After, use capped exponential backoff with jitter, and checkpoint only after the batch and output are atomically committed.
Visual diagram
Theory & deep dive
Pagination: the working mechanism
Reliable REST extraction advances a durable cursor or page token, respects rate-limit headers, retries only retryable failures with backoff, and deduplicates repeated records by a business key.
Endpoint limits, ordering, and idempotency. Cursor, bounded page size, and timeout, then classify status, jitter, and retry budget; this exposes the state governed by Retries.
Request /orders?cursor=opaque&limit=500; on 429 sleep the Retry-After value, persist next_cursor, and upsert merchant_id/order_id so the same response is safe to process twice.
REST API Ingestion, Pagination, Rate Limiting & Retries: failure mode and production response
Page-number pagination drifts when source rows are inserted, immediate retries amplify an outage, and retrying an unguarded POST can duplicate side effects.
Prefer server cursors or updated-at plus stable tie-breakers, honor Retry-After, use capped exponential backoff with jitter, and checkpoint only after the batch and output are atomically committed. Track HTTP 429 as "retry only after the server's delay plus jitter", and make Page size visible to the dataset owner.
Retry-After, use capped exponential backoff with jitter, and checkpoint only after the batch and output are atomically committed.How it works, step by step
Step 1 of 41. Discover
Endpoint limits, ordering, and idempotency. Reliable REST extraction advances a durable cursor or page token, respects rate-limit headers, retries only retryable failures with backoff, and deduplicates repeated records by a business key.
- HTTP 429
- retry only after the server's delay plus jitter
- Rate Limits
- Server-imposed request quotas often exposed through 429 responses and `Retry-After` or remaining-request headers.
When to use it & trade-offs
What it is
Reliable REST extraction advances a durable cursor or page token, respects rate-limit headers, retries only retryable failures with backoff, and deduplicates repeated records by a business key. Request /orders?cursor=opaque&limit=500; on 429 sleep the Retry-After value, persist next_cursor, and upsert merchant_id/order_id so the same response is safe to process twice.
Why it matters: Page-number pagination drifts when source rows are inserted, immediate retries amplify an outage, and retrying an unguarded POST can duplicate side effects. Prefer server cursors or updated-at plus stable tie-breakers, honor Retry-After, use capped exponential backoff with jitter, and checkpoint only after the batch and output are atomically committed.
When to reach for it
- Ingest APIs reliably with pagination strategies, backoff on rate limits, and idempotent retries.
- Choose Pagination because it provides this capability: A stateless or opaque cursor that identifies the next page even as earlier records change.
- Keep evidence for HTTP 429 at "retry only after the server's delay plus jitter" so the last production stage-Commit - deduplicate output, then advance checkpoint-remains testable.
When to avoid or be careful
- Page-number pagination drifts when source rows are inserted, immediate retries amplify an outage, and retrying an unguarded POST can duplicate side effects.
- Do not conflate Rate Limits with Pagination. The second concept contributes different behavior: Server-imposed request quotas often exposed through 429 responses and
Retry-Afteror remaining-request headers. - Release only after this guardrail is in place: Prefer server cursors or updated-at plus stable tie-breakers, honor
Retry-After, use capped exponential backoff with jitter, and checkpoint only after the batch and output are atomically committed.
Pagination / Rate Limits / Retries - roles, limits, and operating cost
Strengths: A stateless or opaque cursor that identifies the next page even as earlier records change. Reliable REST extraction advances a durable cursor or page token, respects rate-limit headers, retries only retryable failures with backoff, and deduplicates repeated records by a business key.
Watch out: Page-number pagination drifts when source rows are inserted, immediate retries amplify an outage, and retrying an unguarded POST can duplicate side effects.
Retry-After or remaining-request headers.Strengths: Server-imposed request quotas often exposed through 429 responses and Retry-After or remaining-request headers. In this workflow it supports: Recover - classify status, jitter, and retry budget.
Watch out: The operating cost is real: bounded by endpoint and in-memory batch limits.
Strengths: Re-executing a request or transform without changing the logical output; append-only destinations still need deduplication. Its output can be checked with Checkpoint.
Watch out: Operating guardrail: Prefer server cursors or updated-at plus stable tie-breakers, honor Retry-After, use capped exponential backoff with jitter, and checkpoint only after the batch and output are atomically committed.
Interview signals & numbers to know
When this topic comes up
- “Where is the failure boundary for Pagination, and how would HTTP 429 reveal it?”
- “Why is Rate Limits distinct from this behavior: re-executing a request or transform without changing the logical output; append-only destinations still need deduplication?”
- Production clue: Page-number pagination drifts when source rows are inserted, immediate retries amplify an outage, and retrying an unguarded POST can duplicate side effects.
- Design probe: Prefer server cursors or updated-at plus stable tie-breakers, honor Retry-After, use capped exponential backoff with jitter, and checkpoint only after the batch and output are atomically committed.
Benchmarks & rules of thumb
- HTTP 429
- retry only after the server's delay plus jitter
- Page size
- bounded by endpoint and in-memory batch limits
- Checkpoint
- advance after sink commit, never merely after HTTP success
Common mistakes & follow-ups
Common interview mistakes
- Page-number pagination drifts when source rows are inserted, immediate retries amplify an outage, and retrying an unguarded POST can duplicate side effects.
- Reporting success from a job exit code without checking HTTP 429 and Page size.
- Treating this example as complete without replay, rollback, or access boundaries: Request
/orders?cursor=opaque&limit=500; on 429 sleep theRetry-Aftervalue, persistnext_cursor, and upsertmerchant_id/order_idso the same response is safe to process twice.
Likely interviewer follow-ups
- How would you prove this contract instead of only checking that the command ran: A stateless or opaque cursor that identifies the next page even as earlier records change.
- What does the recovery plan do when this occurs? Page-number pagination drifts when source rows are inserted, immediate retries amplify an outage, and retrying an unguarded POST can duplicate side effects.
- When is Pagination insufficient for Page size, and what does adding Rate Limits cost in HTTP 429?
Retry-After, use capped exponential backoff with jitter, and checkpoint only after the batch and output are atomically committed.Knowledge check
Put it into practice
Practice related interview Q&A
Apply REST API Ingestion, Pagination, Rate Limiting & Retries with data engineer interview Q&A and hands-on practice.