Bird
Raised Fist0

Look at this REST API error response snippet:

medium📝 Debug Q14 of Q15
Rest API - Error Handling

Look at this REST API error response snippet:

{
  "status": 200,
  "error": "Invalid input data"
}

What is wrong with this error code usage?

AStatus 200 should not be used with an error message
BThe error message is missing a code
CStatus 200 means server error
DThe JSON format is incorrect
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the status code and message

    Status 200 means success, but the message says "Invalid input data" which is an error.
  2. Step 2: Identify the mismatch

    Using 200 with an error message is incorrect; error codes like 400 should be used for invalid input.
  3. Final Answer:

    Status 200 should not be used with an error message -> Option A
  4. Quick Check:

    Status 200 = success, not error [OK]
Quick Trick: Match error messages with proper error status codes [OK]
Common Mistakes:
MISTAKES
  • Ignoring mismatch between status and message
  • Thinking 200 can mean error
  • Assuming JSON format is wrong

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes