Bird
0
0

Given this endpoint documentation snippet:

medium📝 Predict Output Q13 of 15
Rest API - API Documentation
Given this endpoint documentation snippet:
{
  "endpoint": "/users/{id}",
  "method": "GET",
  "parameters": {
    "id": "integer"
  },
  "response": {
    "200": "User object",
    "404": "Not Found"
  }
}
What is the expected response if the user ID does not exist?
AUser object with empty fields
B404 Not Found error
C200 OK with error message
D500 Internal Server Error
Step-by-Step Solution
Solution:
  1. Step 1: Read the response codes in the documentation

    The response section shows "404": "Not Found" which means if the user ID is missing, a 404 error is returned.
  2. Step 2: Match the scenario to the response code

    Since the user ID does not exist, the API returns 404 Not Found, not 200 or 500.
  3. Final Answer:

    404 Not Found error -> Option B
  4. Quick Check:

    Missing resource = 404 Not Found [OK]
Quick Trick: 404 means resource not found, check response codes [OK]
Common Mistakes:
MISTAKES
  • Assuming 200 OK always returns
  • Confusing 404 with 500 server error
  • Expecting empty user object instead of error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes