Bird
0
0

An API returns this error response:

medium📝 Debug Q6 of 15
Rest API - Error Handling
An API returns this error response:
{"error": {"code": 400, "message": 12345}}

What is the issue with this response?
AThe <code>code</code> field should be a string, not a number
BThe <code>message</code> field should be a string, not a number
CThe <code>error</code> object is missing a <code>details</code> field
DThe JSON syntax is invalid
Step-by-Step Solution
Solution:
  1. Step 1: Review the error response fields

    The message field typically contains a descriptive string.
  2. Step 2: Identify the data types

    Here, message is a number (12345), which is incorrect.
  3. Step 3: Check other options

    code as a number is valid; missing details is optional; JSON syntax is correct.
  4. Final Answer:

    The message field should be a string, not a number -> Option B
  5. Quick Check:

    Is message a string? No. [OK]
Quick Trick: Error messages must be strings, not numbers [OK]
Common Mistakes:
  • Assuming numeric messages are valid
  • Confusing code data type requirements
  • Expecting mandatory 'details' field

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes