Bird
0
0

Identify the error in this REST API error response code snippet:

medium📝 Debug Q6 of 15
Rest API - Error Handling

Identify the error in this REST API error response code snippet:

response = {"error": 404, "message": "Not Found"}
A"error" should be a string, not a number
B"message" should be a number, not a string
CThe JSON keys are incorrect
DThere is no error in this response
Step-by-Step Solution
Solution:
  1. Step 1: Check data types of error fields

    The "error" field should describe the error as a string, not a numeric code.
  2. Step 2: Confirm correct usage of message field

    "message" is correctly a string describing the error.
  3. Final Answer:

    "error" should be a string, not a number -> Option A
  4. Quick Check:

    Error field type = string [OK]
Quick Trick: Error descriptions should be strings [OK]
Common Mistakes:
  • Putting codes in error field
  • Swapping message and error types
  • Assuming numeric error is valid

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes