Status codes communicate protocol outcomes, while response bodies provide domain detail. Clients must distinguish invalid input, authentication and transient server failures.
Before you start
You should understand clients, servers, IP addresses and ports. Follow a request through name resolution, connection establishment and application exchange. Distinguish protocol guarantees from deployment policy, and use observations from the relevant layer rather than guessing from one browser error message.
The practical goal is to reason through this situation: A validation failure needs a client-correctable outcome rather than a generic server error. Read the walkthrough first, then try the interview exercise before opening its answer. The important part is explaining the decision and its consequences, rather than remembering a definition alone.
Step-by-step walkthrough
Step 1: Classify protocol outcome
Separate client-correctable errors from server unavailability.
Step 2: Provide domain details
Bodies explain supported recovery without exposing internals.
Step 3: Respect retry guidance
Bound retries by eligibility and total deadline.
Worked scenario
A validation failure needs a client-correctable outcome rather than a generic server error.
A malformed quantity should produce a documented client error, while temporary dependency unavailability may produce a server error. Returning 200 for both forces clients to infer failure from undocumented body strings and misleads monitoring. A 503 is not blanket permission to replay an uncertain non-idempotent operation.
Common mistake
Returning 200 for every failure hides problems from caches, monitors and clients.
Verify the behavior
Verify status and recovery behavior for invalid input, missing identity and transient failure.
Interview exercise
Handle an upstream 503.
Answer and reasoning
Apply bounded eligible retries or a clear unavailable state, respecting deadlines and any retry guidance.
Continue learning
Compare the scenario with the Networking interview questions and test your understanding with the Networking MCQs. For terminology and implementation details, consult the reference material.