Bird
0
0

In a REST API, a client sends a request with a field 'age' set to -5. The server responds with status 422. What is the likely cause?

medium📝 Debug Q7 of 15
Rest API - HTTP Status Codes
In a REST API, a client sends a request with a field 'age' set to -5. The server responds with status 422. What is the likely cause?
AThe 'age' field is missing from the request
BThe 'age' value is semantically invalid despite correct syntax
CThe server does not support the 'age' field
DThe client is unauthorized to send 'age'
Step-by-Step Solution
Solution:
  1. Step 1: Understand semantic validation

    Negative age is invalid logically, so the server rejects it with 422 indicating semantic error.
  2. Step 2: Eliminate other options

    Field is present, so not missing; server supports field; authorization unrelated to 422.
  3. Final Answer:

    The 'age' value is semantically invalid despite correct syntax -> Option B
  4. Quick Check:

    Invalid field value triggers 422 semantic error [OK]
Quick Trick: 422 means data invalid, not missing or unauthorized [OK]
Common Mistakes:
  • Thinking 422 means missing field
  • Confusing 422 with 403 Forbidden
  • Assuming server error instead of validation error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes