Bird
0
0

What will be the output HTTP status and JSON body for this error response?

medium📝 Predict Output Q5 of 15
Rest API - Request and Response Format
What will be the output HTTP status and JSON body for this error response?
{"error": {"code": 500, "message": "Internal Server Error"}}
AStatus 404 with empty body
BStatus 200 with JSON body {"error": {"code": 500, "message": "Internal Server Error"}}
CStatus 500 with JSON body {"error": {"code": 500, "message": "Internal Server Error"}}
DStatus 500 with empty body
Step-by-Step Solution
Solution:
  1. Step 1: Understand error code 500 meaning

    500 means server error, so HTTP status should be 500.
  2. Step 2: Check response body

    The JSON body should include the error details as given.
  3. Final Answer:

    Status 500 with JSON body {"error": {"code": 500, "message": "Internal Server Error"}} -> Option C
  4. Quick Check:

    Server error = status 500 with error JSON [OK]
Quick Trick: Send matching status and error JSON for server errors [OK]
Common Mistakes:
  • Sending status 200 for errors
  • Omitting error details in body
  • Sending empty body with error status

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes