← Back to sandbox
Backend & API Intermediate 6 possible tests

API Response Codes

Six API endpoints — some return the correct HTTP status code, others have mismatches between the status and the response body. Your job is to find where the status code doesn't match reality.

What is this?

HTTP status codes are a contract between the server and the client. A 200 OK must mean success, a 500 must mean failure. When status codes are inconsistent with the response body, clients (and tests) can silently pass on broken behaviour.

What is hidden here

True Negative/api/card/1/ → 200 with valid JSON (correct)
True Positive/api/card/999/ → 404 not found (correct)
Bug/api/card/save/ → 200 but body contains {"error": "Save failed"}
Bug/api/card/update/ → 500 but update actually succeeded
True PositivePOST with invalid data → 400 validation error (correct)
True PositiveUnauthorized request → 401 (correct)

Endpoint Caller

GET /api/card/1/
GET /api/card/999/
POST /api/card/save/ BUG?
PUT /api/card/update/ BUG?
POST /api/card/ (invalid data)
GET /api/card/ (no auth)

HTTP Status
Response Body
Suggested Test Inputs
  • Call each endpoint button and compare the HTTP status code to the response body content
  • Look for cases where 200 doesn't mean success
  • Look for cases where 500 doesn't mean failure