Bird
Raised Fist0

You receive this JSON response:

medium📝 Debug Q6 of Q15
Rest API - Error Handling
You receive this JSON response:
{"type": "https://example.com/probs/out-of-credit", "title": "You do not have enough credit.", "status": "403"}

What is wrong with this Problem Details response?
AThe <code>status</code> field should be an integer, not a string
BThe <code>type</code> field must be a number
CThe <code>title</code> field is missing
DThe JSON is missing the <code>detail</code> field
Step-by-Step Solution
Solution:
  1. Step 1: Check the data types of fields

    The status field must be an integer representing the HTTP status code, but here it is a string "403".
  2. Step 2: Verify other fields

    type is a URI string, which is correct. title is present. detail is optional.
  3. Final Answer:

    status must be integer, not string -> Option A
  4. Quick Check:

    status type = integer [OK]
Quick Trick: status must be a number, not quoted string [OK]
Common Mistakes:
MISTAKES
  • Using string instead of integer for status
  • Thinking type should be numeric
  • Assuming detail is required

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes