Why is a successful HTTP connection not necessarily a successful model request?

Python & APIsFoundations & codingAbout 8 minutes

Understand the idea, explain it in your own words and use the rubric to find your next learning gap.

Local drafts · no account or AI calls
Sukoaa original

The idea behind the question

Transport completion, HTTP success, valid JSON and a valid business result are separate checks. Error handling should preserve this distinction at every API boundary.

AN ILLUSTRATIVE EXAMPLE

A provider sends HTTP 200 with an incomplete response, or an error response contains HTML instead of the JSON your client expected.

TRY A SMALL EXAMPLEPython · standard library
# Synthetic statuses: no network requests are made.
def classify(status):
    if 200 <= status < 300:
        return "check payload"
    if status == 429:
        return "consider bounded retry"
    if status in (401, 403):
        return "check access; do not blindly retry"
    return "handle explicit failure"

for status in [200, 403, 429, 500]:
    print(status, classify(status))
Show expected output
200 check payload
403 check access; do not blindly retry
429 consider bounded retry
500 handle explicit failure
Open Python playground

Copy and paste to run in a separate tab. This example illustrates one concept; it is not a complete application or an automatically graded task.

A practical way to learn it

Run the offline response-classification example. Add a case where HTTP 200 has an invalid payload and describe the expected API error.

Open Python playground

The related tool opens separately; your interview answer stays here. Written practice is self-guided, without automatic code grading.

Build an explanation you understand

  1. State what the concept does in plain language.
  2. Apply it to the example and make your assumptions explicit.
  3. Explain a trade-off, failure case and how you would test it.
  4. Distinguish your actual experience from a proposed approach.

Further reading

Further-reading links support learning; the reference is Sukoaa-authored, not an official employer answer key.