Bird
0
0

You receive this error response from an API:

medium📝 Debug Q14 of 15
Rest API - Request and Response Format
You receive this error response from an API:
{"error": {"code": "403", "message": "Forbidden"}}

But your client expects the code as an integer. What is the best fix?
AChange the message to "Access Denied"
BRemove the code field entirely
CChange the code value to an integer 403 in the response
DWrap the code in quotes to make it a string
Step-by-Step Solution
Solution:
  1. Step 1: Identify data type mismatch

    The code is a string "403" but the client expects an integer 403.
  2. Step 2: Fix the data type in the response

    Change the code value from a string to an integer to match client expectations.
  3. Final Answer:

    Change the code value to an integer 403 in the response -> Option C
  4. Quick Check:

    Match data types for code field [OK]
Quick Trick: Ensure error code data type matches client expectation [OK]
Common Mistakes:
MISTAKES
  • Removing important error fields
  • Changing message instead of code type
  • Leaving code as string when integer needed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes