Bird
0
0

Why is it important for a REST API to return a 400 Bad Request instead of a generic 500 Internal Server Error when the client sends invalid data?

hard📝 Conceptual Q10 of 15
Rest API - HTTP Status Codes

Why is it important for a REST API to return a 400 Bad Request instead of a generic 500 Internal Server Error when the client sends invalid data?

ATo clearly indicate the error is due to client input, not server failure
BTo hide server details from the client
CTo force the client to retry the request later
DTo improve server performance
Step-by-Step Solution
Solution:
  1. Step 1: Understand HTTP error semantics

    400 means client error; 500 means server error. Clear distinction helps debugging.
  2. Step 2: Explain why this matters

    Returning 400 helps client fix request; 500 wrongly suggests server problem.
  3. Final Answer:

    To clearly indicate the error is due to client input, not server failure -> Option A
  4. Quick Check:

    400 shows client error; 500 shows server error [OK]
Quick Trick: 400 means client error; 500 means server error [OK]
Common Mistakes:
  • Confusing client and server error codes
  • Thinking 500 hides server details
  • Assuming 400 forces retries

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes