This is the kind of question that sounds easy until you're actually saying it out loud and realize you're skipping three layers.
Start by clarifying the scope and assumptions (e.g., typical cloud deployment, HTTP/1.1, no caching) to show you think before diving in. Then walk through the request lifecycle in a logical, layered order: network edge, load balancer, application server, business logic, data layer, and response. Finally, highlight where performance, security, and reliability considerations come into play.
Pro tip: Emphasize observability and failure modes—mention how you'd trace a request end-to-end (e.g., correlation IDs, logging, metrics) and what happens when a component fails (e.g., timeouts, retries, circuit breakers). This shows you think beyond the happy path and understand production systems.
Ask or state assumptions about the architecture (e.g., cloud-based, behind a load balancer, using a framework like Express or Django) to set context and avoid ambiguity.
Describe DNS resolution, TCP handshake, TLS negotiation, and how the request reaches the load balancer or reverse proxy, then gets forwarded to an application server.
Cover how the server parses the HTTP request, routes it to the appropriate handler, and executes middleware (e.g., authentication, logging) before business logic.
Walk through how the handler interacts with databases, caches, or external services, including query execution, data transformation, and error handling.
Explain how the response is serialized (e.g., JSON), sent back through the same layers, and how the client receives and renders it, noting any caching or compression.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.
Start by defining each HTTP method in terms of its core semantics (safe, idempotent, cacheable) and typical use cases. Then explain how they map to CRUD operations and RESTful API design, and discuss practical considerations like idempotency and when to deviate from strict REST (e.g., POST for complex queries).
Pro tip: Emphasize idempotency and safety because they are critical for building reliable, cacheable APIs and handling retries—shows you think beyond basic CRUD. Also, mention that while REST is a guideline, real-world APIs sometimes use POST for read operations with complex bodies, so be ready to justify trade-offs.
Briefly state what GET, POST, PUT, and DELETE are intended for: GET retrieves data, POST creates or submits data, PUT updates/replaces a resource, DELETE removes a resource.
Discuss safety (no side effects) and idempotency (same result if repeated). GET and DELETE are idempotent; PUT is idempotent; POST is neither safe nor idempotent.
Show how they align with CRUD operations and RESTful resource design: GET /users, POST /users, PUT /users/{id}, DELETE /users/{id}.
Give practical examples: GET for fetching data, POST for creating resources or non-idempotent actions, PUT for full updates, DELETE for removal. Mention PATCH for partial updates.
Talk about idempotency in retries, caching with GET, security (e.g., not using GET for sensitive data), and when to use POST for complex queries despite REST conventions.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.
Start by defining HTTP status codes as three-digit numbers in the response line that indicate the outcome of a request. Then explain the five classes (1xx–5xx) with their general meaning, focusing on 2xx, 4xx, and 5xx as requested, and give a common example for each. Finally, connect this to API design by discussing how clients should handle each class and why proper status code usage matters for reliability and debugging.
Pro tip: Emphasize that status codes are part of the API contract and that choosing the right code (e.g., 400 vs 422, 401 vs 403) improves client error handling and observability. Mention that 5xx errors should be logged and alerted on, while 4xx errors often indicate client-side issues that may not need immediate attention.
Explain that status codes are three-digit numbers returned by a server in the HTTP response, grouped into five classes based on the first digit. They provide a standardized way to communicate the result of a request.
Describe 2xx codes as indicating successful request processing. Give examples like 200 OK for general success, 201 Created for resource creation, and 204 No Content for successful requests with no body.
Describe 4xx codes as indicating errors caused by the client, such as malformed requests or missing authentication. Give examples like 400 Bad Request, 401 Unauthorized, 403 Forbidden, and 404 Not Found.
Describe 5xx codes as indicating errors on the server side, meaning the request was valid but the server failed to fulfill it. Give examples like 500 Internal Server Error, 502 Bad Gateway, and 503 Service Unavailable.
Discuss how clients should interpret these codes (e.g., retry on 5xx, not on 4xx) and how API developers should choose appropriate codes to convey precise error conditions. Mention that proper status code usage aids debugging, monitoring, and automated error handling.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.
I explained the basic flow: server sets a cookie with a session ID, client sends it back on each request, server looks up the session.
Start by defining cookies and sessions and their roles in HTTP state management. Then explain the typical flow: server creates a session, stores data server-side, and sends a session ID via a cookie; client includes the cookie in subsequent requests, allowing the server to retrieve the session. Finally, discuss security considerations and alternatives like tokens.
Pro tip: Mention how Airtable likely uses sessions for its web app and cookies for authentication, and highlight the importance of secure cookie attributes (HttpOnly, Secure, SameSite) to prevent XSS and CSRF.
Explain that cookies are small pieces of data stored client-side and sent with each request, while sessions are server-side data stores identified by a session ID.
When a user logs in, the server creates a session, stores user data (e.g., user ID) server-side, and sends a cookie containing the session ID to the client.
The client automatically includes the session cookie in every request to the same domain; the server uses the session ID to look up the session data and maintain state.
Cover cookie attributes like HttpOnly, Secure, SameSite, session expiration, and regeneration to prevent session hijacking and CSRF.
Briefly compare with token-based auth (e.g., JWT) and stateless approaches, noting scalability and statelessness benefits.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.
Blanked for a second on the preflight request part.
Start by defining CORS as a browser security mechanism that controls cross-origin requests, then explain the same-origin policy it enforces and why it exists (to prevent malicious sites from reading sensitive data). Finally, describe how the browser enforces it via preflight requests and response headers, and mention common pitfalls like misconfigured servers.
Pro tip: Emphasize that CORS is enforced by the browser, not the server—the server just provides headers—and that it's a common source of confusion in API integrations, so showing you understand the client-side enforcement and server-side configuration trade-offs will impress.
Explain that CORS (Cross-Origin Resource Sharing) is a browser security feature that allows or restricts web pages from making requests to a different origin than the one that served the page. Its purpose is to relax the same-origin policy in a controlled way.
Describe the same-origin policy as a fundamental browser security model that prevents scripts from one origin from accessing resources from another origin. Clarify that an origin is defined by scheme, host, and port.
Detail the mechanism: for simple requests, the browser sends the request and checks the response headers (e.g., Access-Control-Allow-Origin). For non-simple requests (e.g., with custom headers or methods like PUT), the browser sends a preflight OPTIONS request to verify the server allows the actual request.
Mention that servers must include appropriate CORS headers to allow cross-origin access, and that misconfigurations (e.g., overly permissive origins) can introduce security risks. Highlight trade-offs between security and functionality.
Relate CORS to common development challenges, such as integrating third-party APIs or building frontend-backend architectures, and note that CORS errors are client-side and cannot be fixed by server logs alone.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.
Talked through statelessness, resource-based URLs, uniform interface, using HTTP methods semantically.
Start by defining REST as an architectural style, not a protocol, and then explain the core constraints that make an API RESTful. Use concrete examples from well-known APIs (like Airtable's) to illustrate each constraint, and briefly contrast REST with alternatives like GraphQL or RPC to show depth.
Pro tip: Emphasize that REST is about constraints and trade-offs, not a strict standard—many 'RESTful' APIs relax some constraints (like HATEOAS) for practicality. Mentioning this shows you understand real-world engineering decisions.
State that REST (Representational State Transfer) is an architectural style defined by Roy Fielding, based on a set of constraints for designing networked applications.
Enumerate the six constraints: client-server, statelessness, cacheability, uniform interface, layered system, and code-on-demand (optional). Briefly explain each.
Detail the four sub-constraints: identification of resources, manipulation through representations, self-descriptive messages, and HATEOAS (hypermedia as the engine of application state).
Provide examples of RESTful conventions: using HTTP verbs (GET, POST, PUT, DELETE), resource-based URLs (e.g., /users/123), status codes, and JSON representations.
Mention that strict REST (especially HATEOAS) is rare; many APIs are 'RESTish'. Contrast with GraphQL, gRPC, or RPC-style APIs to show when REST is appropriate.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.
Covered base64 encoding of credentials, why it needs HTTPS, and the fact that credentials go on every request.
Start by clearly explaining the mechanics of basic authentication, then systematically compare its limitations to token-based approaches. Use concrete examples to illustrate security and scalability issues, and conclude by discussing when each method is appropriate.
Pro tip: Mention that basic auth should only be used over HTTPS and is often acceptable for internal tools or simple integrations, but for user-facing APIs, token-based methods like OAuth 2.0 or JWT are preferred due to better security and scalability.
Explain that basic auth sends a base64-encoded username:password string in the Authorization header with each request. Emphasize that it's stateless and simple to implement.
Discuss security risks: credentials sent in plaintext (mitigated by HTTPS), no built-in expiration or revocation, vulnerable to replay attacks, and poor fit for distributed systems. Also mention scalability issues with frequent credential checks.
Describe token-based auth (e.g., OAuth 2.0, JWT) where a token is issued after initial authentication and sent with subsequent requests. Tokens can be scoped, expire, and be revoked.
Contrast basic auth with token-based: tokens offer better security (short-lived, revocable), scalability (stateless validation), and fine-grained access control. Basic auth is simpler but less secure and flexible.
Summarize when to use each: basic auth for simple, internal, or low-risk scenarios; token-based for public APIs, mobile apps, and systems requiring granular permissions.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.