Loading...
Loading...
Browse 11 real-world technical and behavioral interview questions about Api design. Review scenarios, edge cases, and architectural best practices.
Return a strong ETag on GET, require If-Match on writes, and reject a stale token with 412 Precondition Failed so a lost update becomes a visible error rather than silent data loss. What makes it correct is that the comparison and the write must be one atomic operation - an UPDATE guarded by the version in its WHERE clause - because a SELECT then UPDATE reintroduces the race.
Substitutability is a claim about behaviour, and signatures carry none of it. A subclass that rejects an argument its supertype accepted has strengthened a precondition, which the compiler cannot see: the code type-checks, and it breaks callers that were written correctly against the base type.
Choose per consumer: GraphQL where many client shapes make over-fetching the problem, gRPC for internal traffic wanting typed generated stubs and streaming, plain JSON over HTTP for partners who want curl and a CDN. Then batch your resolvers, because the N+1 is structural.
Consent is a first-class server-side resource with an account set, a permission set and an expiry, revocable from either side, and every data read is authorised against it rather than against a token's scope; authentication stays at the bank, and adoption is won on stable error semantics.
Treat errors as published contract: an HTTP status that classifies the failure, a stable machine-readable code the client branches on, a human message that carries no internal detail, per-field detail for validation, and an explicit statement of whether a retry is safe.
Model resources around client workflows, paginate with an opaque keyset cursor because offset pagination skips and duplicates rows under concurrent writes, make unsafe operations replayable with a client-supplied idempotency key, and evolve additively so that versioning stays a last resort rather than a routine.
Accept the request, return 202 with the location of an operation resource, and do the work behind a queue. Clients poll that resource or receive a signed callback, and either way the operation id is the contract - one that a callback can reach before the submitter has finished recording it.
Design system component customization should expose sanctioned variants, slots for content and a visible escape hatch, not arbitrary styling on every part. Once any product can restyle a shared component freely, consistency becomes unenforceable.
Offset pagination gets slower with depth and drifts when rows are inserted mid-traversal, so paginate with a keyset comparison on the sort key plus a unique tiebreaker, hand back an opaque cursor and a Link rel=next header, and price an exact total count separately.
Thumbnail generation system design should return one displayable image immediately while every durable variant is produced asynchronously. Persist the original, write metadata, show a client-side preview or first small thumbnail, and expose variant readiness so the UI never asks for an image size that is not ready.
A synchronous call couples availability and latency but keeps the outcome knowable at the point of decision; an event decouples both but converts every failure into something the caller will never learn about. Choose by asking whether the caller needs the answer to proceed, not by which style is fashionable.