Skip to content
Preptima

HTTP & REST interview questions

Methods and status semantics, caching headers, content negotiation, and HTTP/2 and HTTP/3 differences.

4 questions in Backend Engineering.

medium3

mediumConceptDesignScenario

Two clients open the same record, both edit it, and the second save silently overwrites the first. How would you use ETags to turn that lost update into something the client can see and handle?

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.

4 minmid, senior, staff
mediumConcept

Which status codes and method semantics do you insist on in a code review, how do the caching headers fit together, and is the API you just described REST?

Get the method's safety, idempotency and cacheability right, use the status code intermediaries and clients act on rather than a generic 200 with an error body, pair Cache-Control freshness with ETag or Last-Modified validators, and be honest that most APIs called REST are resource-shaped HTTP without hypermedia.

6 minentry, mid, senior

hard1