Interview's MateData Engineer
Interview's Mate

Data Engineer

SQL · Spark · Lakehouse · Streaming

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Data Engineer topics
Lesson 13/ 160
01. Data Engineering Foundations, Python & Linux

REST API Ingestion, Pagination, Rate Limiting & Retries

Ingest APIs reliably with pagination strategies, backoff on rate limits, and idempotent retries.

IntermediatePagination · Rate Limits · Retries3 quiz questions
Practice Generative AI Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

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-After or 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

Loading interactive 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.

REST API Ingestion, Pagination, Rate Limiting & Retries in one concrete design

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.

Key takeaway: 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

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.

Key takeaway: 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.

How it works, step by step

Step 1 of 4
Pagination

1. 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.

endpoint limits, ordering, and idempotency
Key numbers at this step
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-After or 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

Pagination
Best for: A stateless or opaque cursor that identifies the next page even as earlier records change.

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.

Rate Limits
Best for: Server-imposed request quotas often exposed through 429 responses and 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.

Retries
Best for: Re-executing a request or transform without changing the logical output; append-only destinations still need deduplication.

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 the Retry-After value, persist next_cursor, and upsert merchant_id/order_id so 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?
Interview tip: Lead with the data path and failure boundary: 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. Then make the answer operational: 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.

Knowledge check

Loading quiz

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.

Open Data Engineer Q&A →Machine Learning Q&A
Previous topic
Querying Local Files at Lightning Speed with DuckDB
Next topic
Asynchronous Python (asyncio, aiohttp) for High-Throughput Extraction