REST API: Architecture, Practice & Interviews

This flashcard set helps you study REST API design systematically at middle, senior, and system design levels. It covers key topics such as REST principles, HTTP methods and status codes, resource modeling, API contracts, validation, versioning, backward compatibility, security, authorization, caching, pagination, performance, asynchronous operations, webhook integrations, observability, and production operations. The set is designed for technical interview preparation, architecture reviews, public and internal API design, and deep practical learning. It focuses not only on theory, but also on real-world engineering scenarios: error handling, idempotency keys, rate limiting, optimistic locking, N+1 problems, bulk operations, API gateways, multi-tenant SaaS, and third-party integrations. This package is useful for backend developers, fullstack developers, team leads, and software architects who want to design reliable, secure, and scalable REST APIs. It can be used as a checklist before implementing an API, a structured interview preparation tool, or a complete learning path for understanding REST API design in production systems.

You can start studying this pack. You'll receive 480 messages to help you review each card multiple times, following the principles of the forgetting curve.

Learn more about the spaced repetition method.
REST API

What is a REST API, what are the REST architectural constraints, how REST differs from a simple HTTP API, and what problems appear when REST principles are followed only superficially?

1/120
Statelessness in REST API design

What does statelessness mean in REST API design, including client-side state management, its impact on scalability, and the limitations it creates for user sessions?

2/120
Resource-oriented design (REST)

What is resource-oriented design in REST APIs, including modeling entities as resources, choosing URIs, and the problems of representing business actions as resources?

3/120
Resource URIs in REST APIs

How should resource URIs be designed in REST APIs, including nesting, readability, long-term stability, and the limitations of deeply nested hierarchies?

4/120
Selecting HTTP methods for REST APIs

How should HTTP methods be selected in REST APIs, including GET, POST, PUT, PATCH, DELETE, and what problems arise when methods are used incorrectly for business operations?

5/120
Safe HTTP methods and GET behavior

What does a safe HTTP method mean, including the behavior of GET, its impact on caching, and the problems caused by performing state-changing operations through GET?

6/120
Idempotency in HTTP methods

What is idempotency in HTTP methods, and how do PUT and DELETE behave? How does idempotency differ from safety, and what are the consequences for retrying requests after network failures?

7/120
HTTP status codes in REST APIs

How should HTTP status codes be used in REST APIs, including 2xx, 3xx, 4xx, 5xx, and the problems caused by returning every error as 200 OK?

8/120
Distinguishing 400, 401, 403, 404, 409, 422 in REST APIs

How should 400, 401, 403, 404, 409, and 422 errors be distinguished in REST APIs, and what are practical use cases and risks of ambiguous handling?

9/120
REST API response design

How should a REST API response format be designed, including envelopes, payloads, metadata, and the trade-offs between consistency and excessive response verbosity?

10/120
REST API error response design

How should an error response format be designed in REST APIs, including machine-readable codes, human-readable messages, details, trace IDs, and the risks of exposing internal system information?

11/120
HTTP-заголовки в REST API

Краткое руководство по использованию HTTP‑заголовков в REST API.

12/120
Designing a REST API contract

How to design a REST API contract: request and response schemas, required fields, and handling backward compatibility when the contract changes.

13/120
Organizing REST API documentation

How should REST API documentation be organized, including request examples, error examples, usage scenarios, and the problem of documentation becoming outdated compared to implementation?

14/120
Request validation in REST APIs

How should request validation be designed in REST APIs, including type checks, required fields, business constraints, and the difference between syntactic and domain errors?

15/120
OpenAPI Specification — overview

What is the OpenAPI Specification, including endpoint descriptions, schemas, parameters, errors, and limits of generating docs automatically from code?

16/120
REST API response validation

Short answer: Response validation ensures responses conform to the agreed contract (schema), prevents accidental breaking changes by catching deviations early, and is essential for reliable integration testing between services.

17/120
Managing REST API schema changes

How should REST API schema changes be managed, including adding new fields, removing old fields, changing field types, and the risks for existing clients?

18/120
Nullable and optional fields in REST APIs

How should nullable and optional fields be designed in REST APIs, and what is the difference between missing, null and empty values? Which problems arise during partial updates and how to avoid them?

19/120
Designing enum fields in REST APIs

How should enum fields be designed in REST APIs, including extensibility of values, behavior of old clients, and the problems caused by strict client-side validation?

20/120
API contracts for web, mobile, and external clients

How should API contracts be designed for different clients, including web, mobile, and external integrations, and what are the trade-offs between a universal API and client-specific endpoints?

21/120
Modeling core REST API resources

How should core REST API resources be modeled: identifiers, relationships, lifecycle, and avoiding leakage of internal DB structure?

22/120
Choosing resource identifiers: auto-increment IDs, UUIDs, ULIDs — trade-offs

How should resource identifiers be chosen, including auto-increment IDs, UUIDs, ULIDs, and the trade-offs between readability, security, and index performance?

23/120
Designing nested resources in REST APIs

How should nested resources be designed in REST APIs, including /users/{id}/orders, independent collections, and the problem of duplicate paths for the same entity?

24/120
Designing nested resources in REST APIs

How to design nested resources such as /users/{id}/orders, when to keep independent collections, and how to avoid duplicate paths for the same entity.

25/120
Many-to-many relationships in REST APIs

How should many-to-many relationships be designed in REST APIs, including linking resources, nested endpoints, and the limitations of updating relationships?

26/120
Aggregated resources in REST APIs

How should aggregated resources be designed in REST APIs, including summary fields, computed values, denormalized responses, and the risk of data inconsistency?

27/120
Designing include/expand mechanisms in REST APIs

How to design include/expand mechanisms in REST APIs to load related entities, prevent N+1 queries, and avoid problems caused by overly flexible queries.

28/120
Include / Expand mechanisms in REST APIs

How should include or expand mechanisms be designed in REST APIs, including loading related entities, preventing N+1 queries, and the limitations of overly flexible queries?

29/120
Designing DTOs for REST APIs

How should DTOs be designed for REST APIs, including separating API models from database entities, protecting internal fields, and the cost of additional mapping?

30/120
Partial responses in REST APIs

How should partial responses be designed in REST APIs, including client-selected fields, traffic reduction, and the problems this creates for caching and field-level authorization?

31/120
PATCH requests in REST APIs

How should PATCH requests be designed in REST APIs, including JSON Merge Patch, JSON Patch, partial field updates, and problems with null values?

32/120
REST API versioning

How should REST APIs be versioned, including versioning in the URL, versioning in headers, media type versioning, and trade-offs for public and internal APIs?

33/120
Designing bulk operations in REST APIs

How should bulk operations be designed in REST APIs: mass creation, mass updates, mass deletion, and handling partial success within a single operation?

34/120
Feature rollout in REST APIs

How should feature rollout be designed in REST APIs, including feature flags, gradual rollout, canary clients, and compatibility issues between backend and frontend versions?

35/120
Safe removal of deprecated REST API endpoints

How should deprecated REST API endpoints be safely removed, including usage monitoring, client notification, grace periods, and the risk of silent breakage?

36/120
Maintaining backward compatibility in REST APIs

How should backward compatibility be maintained in REST APIs, including additive changes, deprecation policies, migration windows, and the problems caused by clients that update rarely?

37/120
Versioning mobile clients in REST APIs

How should different versions of mobile clients be handled in REST APIs, including long application lifecycles, forced updates, and the cost of supporting old contracts?

38/120
Resource states in REST APIs

How should resource states be designed in REST APIs, including draft, active, archived, deleted, and the limitations of transitions between states?

39/120
Authentication in REST APIs

How should authentication be designed in REST APIs, including session cookies, bearer tokens, JWTs, and trade-offs between statelessness and session manageability?

40/120
Authorization in REST APIs

How should authorization be designed in REST APIs, including role-based access control, attribute-based access control, ownership checks, and the problem of validating permissions for every resource?

41/120
Safe use of JWTs in REST APIs

How should JWTs be used safely in REST APIs, including token lifetime, refresh tokens, token revocation, and client-side token storage problems?

42/120
Rate limiting for REST APIs

How should rate limiting be designed for REST APIs, including limits by user, IP address, API key, endpoint, and fair distribution between clients?

43/120
Protecting REST APIs from brute force and credential stuffing

How should REST APIs be protected against brute force and credential stuffing, including throttling, account lockout, captcha, risk-based checks, and trade-offs with user experience?

44/120
Protecting REST APIs from CSRF

How to protect REST APIs from Cross-Site Request Forgery (CSRF): differences between cookie-based auth and bearer tokens, role of SameSite cookies, and why frontend-only defenses are insufficient.

45/120
Protecting REST APIs from XSS-related risks

How to protect REST APIs from XSS-related risks: token storage, data sanitization, output encoding, and handling client-side compromises.

46/120
CORS for REST APIs

How to configure CORS for REST APIs: allowed origins, credentials, preflight requests, and risks of unsafe wildcard configurations.

47/120
Protecting REST APIs from mass assignment

How should REST APIs be protected against mass assignment, including field whitelisting, DTO validation, and the problem of mapping request bodies directly into ORM entities?

48/120
Designing API Keys for External Integrations

How should API keys be designed for external integrations, including scopes, rotation, expiration, audit trails, and the problem of key leakage on the client side?

49/120
Restricting access to sensitive data in REST APIs

How should access to sensitive data be restricted in REST APIs, including field-level authorization, masking, audit logging, and the risk of accidental personal data exposure?

50/120
REST API caching: Cache-Control, ETag, Last-Modified, CDN, and personalized data

How to design caching for REST APIs: principles, headers to use, CDN interaction, and handling of personalized responses.

51/120
Sorting in REST APIs

How should sorting be designed in REST APIs to be stable, performant and deterministic across pages?

52/120
Pagination in REST APIs

How should pagination be designed in REST APIs, including offset pagination, cursor pagination, keyset pagination, and trade-offs for large datasets?

53/120
ETag in REST APIs

How should ETag be used in REST APIs, including conditional GET requests, optimistic concurrency control, and the limitations of generating ETags for aggregated resources?

54/120
Filtering in REST APIs

How should filtering be designed in REST APIs, including query parameters, ranges, full-text search, and the limitations of overly flexible query languages?

55/120
Preventing N+1 problems in REST APIs

Overview: N+1 occurs when an API handler issues one query to fetch N parent rows then issues N additional queries to fetch related data. That pattern kills performance at scale. This card summarizes common prevention techniques: eager loading, batching endpoints, DataLoader-style request-level batching/caching, and how include/expand options affect performance.

56/120
Response compression in REST APIs

Designing response compression in REST APIs: when and how to use gzip/Brotli, size thresholds, and trade-offs between CPU usage and network traffic.

57/120
Resource creation in REST APIs

How should resource creation be designed in REST APIs, including transactions, validation, side effects, and the problem of partially completed operations?

58/120
Large file upload patterns (multipart, resumable, presigned URLs)

How should APIs for large file uploads be designed, including multipart uploads, resumable uploads, pre-signed URLs, and the limitations of sending files through the main backend?

59/120
Optimizing REST APIs for Mobile Clients

How should REST APIs be optimized for mobile clients, including latency, response size, unstable networks, and the problems caused by overly granular endpoints?

60/120
Optimistic locking in REST APIs

How to design optimistic locking in REST APIs using version fields, ETags, If-Match headers, and how to behave on concurrent-update conflicts.

61/120
Designing download endpoints in REST APIs

How to design download endpoints in REST APIs: streaming, range requests, access control, and memory considerations when serving large files.

62/120
Handling repeated POST requests in REST APIs

How should repeated POST requests be handled in REST APIs, including idempotency keys, retry logic, duplicate detection, and the problem of network timeouts after successful operations?

63/120
Eventual consistency in REST APIs

How should eventual consistency be designed in REST APIs: handling asynchronous processing, delayed reads, status endpoints, and managing user expectations?

64/120
BFF: Choosing REST endpoint boundaries

How should REST endpoint boundaries be chosen in a backend-for-frontend (BFF) architecture, considering client-specific needs, data aggregation, and the risk of duplicated business logic?

65/120
Designing REST APIs in microservices

How to design REST APIs in a microservices architecture covering data ownership, API gateways, service boundaries and the distributed monolith problem.

66/120
Read-after-write consistency in REST APIs

How to provide read-after-write consistency in REST APIs: patterns, practical techniques (primary reads, cache invalidation, sticky sessions) and performance trade-offs.

67/120
Designing REST APIs on top of distributed transactions (sagas, outbox, compensations)

How should REST APIs be designed on top of distributed transactions, including the saga pattern, outbox pattern, compensating actions, and rollback problems across services?

68/120
REST API Gateway design

How should a REST API gateway be designed, including authentication, routing, rate limiting, request transformation, and the limitations of centralized gateway logic?

69/120
Asynchronous operations in REST APIs

How should asynchronous operations be designed in REST APIs: 202 Accepted, job resources, polling, callbacks (webhooks), and why long-running work should not usually run inside a single HTTP request?

70/120
Designing REST APIs for external partners

How should REST APIs for external partners be designed, including contract stability, quotas, audit logs, sandbox environments, and the difficulties of supporting third-party integrations?

71/120
HTTP 409 Conflict in REST APIs

How should 409 Conflict be handled in REST APIs, covering concurrent updates, unique constraints, business-rule conflicts, and client retry expectations?

72/120
Choosing between REST and gRPC

Compare REST and gRPC across performance, strict contracts, browser support, streaming, and suitability for external integrations.

73/120
Choosing between REST APIs and Message Queues

How should the choice between REST API and message queues be made, including latency, reliability, backpressure, retry semantics, and requirements for synchronous client responses?

74/120
Designing REST APIs for Event-Driven Systems

How to design REST APIs that coexist with an event-driven architecture: commands over HTTP, events through a broker, eventual consistency, and a clear separation of synchronous and asynchronous communication.

75/120
Choosing between REST and GraphQL

How should the choice between REST API and GraphQL be made, including client control over data, caching, public integrations, and schema maintenance complexity?

76/120
Designing webhooks alongside REST APIs

How should webhook integrations be designed alongside REST APIs, including delivery guarantees, retries, signatures, idempotency, and event ordering problems?

77/120
Distributed tracing for REST APIs

How should distributed tracing be designed for REST APIs, including trace ID propagation, spans across services, correlated logs, and limitations in asynchronous processes?

78/120
REST API logging design

How should logging be designed for REST APIs, including request IDs, user IDs, endpoints, latency, error codes, and handling sensitive data?

79/120
REST API metrics to monitor

Which metrics should be selected for REST APIs: RPS, latency percentiles, error rate, saturation, and why averages can be misleading compared to p95/p99?

80/120
Incident analysis for REST APIs

How to investigate REST API incidents: reconstruct timeline, identify affected endpoints, determine root cause, apply mitigations, and prevent recurrence.

81/120
Alerting for REST APIs

How should alerting be designed for REST APIs, including SLOs, error budgets, latency alerts, and the problem of noisy alerts without clear user impact?

82/120
Health checks for REST APIs

How should health checks be designed for REST APIs — liveness, readiness, dependency checks, and how to avoid incorrectly removing a service from the load balancer?

83/120
Audit trails for REST APIs

How should audit trails be designed for REST APIs to record who did something, which resource was affected, when it happened, what the result was, and what storage/retention rules apply in regulated systems?

84/120
Testing REST APIs: unit, integration, and end-to-end

How should REST APIs be tested at unit, integration, and end-to-end levels, including the boundaries of each test type, test data, and the problem of fragile E2E scenarios?

85/120
Designing test environments for REST APIs

How should test environments be designed for REST APIs, including staging, sandbox, mock services, test data isolation, and differences from production behavior?

86/120
Graceful shutdown for REST APIs

How to design graceful shutdown so APIs finish active requests, deregister from the load balancer, set sensible timeouts, and reduce the risk of losing in‑flight operations?

87/120
Testing REST API security

How to test REST API security: focus on authorization bypass, injection, rate limiting and improving negative-scenario coverage.

88/120
REST API load testing

How should REST API load testing be performed, including RPS, latency, concurrency, realistic traffic profiles, and the problem of testing without downstream dependencies?

89/120
Order placement REST API — design

How to design a robust REST API for order placement: order creation, inventory reservation, payment, idempotency, and handling partially completed workflows.

90/120
Contract testing for REST APIs

How should contract testing be used for REST APIs, including consumer-driven contracts, provider verification, and the problem of misalignment between teams?

91/120
Payments API: idempotency, statuses, webhooks, and duplicate-risk

How to design a REST API for payments that handles idempotent client retries, clear transaction status, provider webhooks, and minimizes the risk of duplicate charges during network failures.

92/120
Testing REST API resilience to dependency failures

How should REST APIs be tested for resilience to dependency failures, including timeouts, retries, circuit breakers, fallbacks, and the risk of retry storms?

93/120
REST API design for data import (file upload, async processing, error reporting, partially valid records)

How to design a REST API for importing data with file upload, asynchronous processing, error reports, and handling partially valid records.

94/120
Notifications REST API design

How should a REST API for user notifications be designed, including event creation, delivery through multiple channels, delivery status, and the limitations of synchronous sending?

95/120
Designing a REST API for comments

How should a REST API for comments be designed, including nesting, moderation, soft deletion, sorting, and the limitations of deeply nested tree structures?

96/120
Designing real-time statuses for REST APIs

How to design a system that provides real-time status updates: compare polling, long polling, Server-Sent Events (SSE), WebSocket, and the limits of a pure REST approach.

97/120
Designing a REST API for product search

How to design a REST API for product search that supports filters, sorting, facets, pagination and performs well on large catalogs?

98/120
Designing a REST API for Access Management

How should a REST API for access management be designed, including roles, permissions, inheritance, ownership, and the problem of caching user permissions?

99/120
Passing complex state via query parameters

What problems arise when passing complex state through query parameters?

100/120
Problems of using POST for every REST operation

What problems arise when POST is used for all REST API operations?

101/120
Problems of verb-based REST APIs

What problems arise when REST APIs are designed around verbs instead of resources, including inconsistent modeling, documentation complexity, and endpoint proliferation?

102/120
Admin panel REST API design (filtering, auditing, bulk ops, risks)

How should a REST API for an admin panel be designed, including filtering, action auditing, bulk operations, and the risks of overly powerful endpoints?

103/120
Designing a REST API for multi-tenant SaaS

How should a REST API for multi-tenant SaaS be designed, including tenant isolation, tenant-aware authorization, rate limits, and the risk of data leakage between tenants?

104/120
Problems when APIs return 200 OK for all errors

What problems arise when REST APIs return 200 OK even for errors (validation failures, auth errors, server faults)?

105/120
Problems when using POST for all REST operations

What problems arise when POST is used for all REST API operations?

106/120
Problems of overly fine-grained REST endpoints

What problems arise when REST endpoints are too fine-grained, causing chatty APIs, high latency, unnecessary round trips, and poor mobile user experience?

107/120
Problems of exposing DB schema directly via REST

What problems arise when a database schema is exposed directly through REST APIs?

108/120
Problems with oversized REST endpoints

What problems arise when REST endpoints are too large, including overfetching, authorization complexity, weak reusability, and increased coupling between client and server?

109/120
Unlimited pagination and filtering — problems and mitigations

What problems arise when pagination and filtering have no limits, including database overload, denial-of-service risks, and unpredictable latency?

110/120
Inconsistent REST API error rules — problems and consequences

What problems arise when REST APIs do not have consistent error rules, including inconsistent response bodies, complex SDKs, and worse developer experience?

111/120
Problems when authorization logic is split between frontend and backend

What problems arise when authorization business logic is split between frontend and backend, including bypass risks, duplicated rules, and audit complexity?

112/120
REST API architecture review — quality checklist

How to evaluate REST API quality during an architecture review: a practical checklist covering resource model clarity, contract stability, security, observability and operational risks.

113/120
Zero-downtime REST API design

How should a REST API be designed for zero-downtime deployment, including backward-compatible migrations, the expand-and-contract pattern, and rolling update risks?

114/120
Designing a public REST API for thousands of clients

How should a public REST API for thousands of external clients be designed, including versioning, rate limits, documentation, SDKs, and long-term compatibility?

115/120
Decision to add a new REST endpoint

How should the decision to introduce a new REST endpoint be made, including the existing resource model, client needs, support for old clients, and maintenance cost?

116/120
Designing a REST API for high-load services

How should a REST API for a high-load service be designed, including load balancing, caching, read replicas, backpressure, and graceful degradation under peak traffic?

117/120
Multi-region REST API design

How should a REST API for a multi-region system be designed, including latency, data residency, replication lag, and consistency problems across regions?

118/120
Evaluating trade-offs: REST simplicity vs client query flexibility

How to evaluate trade-offs between a simple REST API and giving clients more flexible querying (to avoid overfetching/underfetching), while considering caching and backend complexity.

119/120
When REST becomes unsuitable

When is REST no longer a good fit? Signs, requirements and practical alternatives for real-time, streaming, graph queries, low-latency S2S and architectural choices.

120/120
WitSlice © 2026