Bird
0
0

Consider this JSON response from a REST API:

medium📝 Predict Output Q13 of 15
Rest API - HTTP Status Codes
Consider this JSON response from a REST API:
{
  "status": 422,
  "errors": {
    "email": "Invalid email format",
    "password": "Password too short"
  }
}
What does this response tell the client?
AThe server could not process the request because the email and password fields are invalid.
BThe server processed the request successfully with no errors.
CThe server is down and cannot handle requests.
DThe client is not authorized to access this resource.
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the status code

    Status 422 means the server understood the request but found invalid data.
  2. Step 2: Interpret the errors object

    The errors show specific problems: invalid email format and password too short.
  3. Final Answer:

    The server could not process the request because the email and password fields are invalid. -> Option A
  4. Quick Check:

    422 + errors = invalid input fields [OK]
Quick Trick: 422 with errors means input fields have problems [OK]
Common Mistakes:
  • Thinking 422 means server failure
  • Ignoring the errors object details
  • Assuming success when status is 422

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes