Bird
0
0

What will be the response body of a GET request to /users/3 if the user with ID 3 exists and has name 'Alice'?

medium📝 Predict Output Q4 of 15
Rest API - HTTP Methods
What will be the response body of a GET request to /users/3 if the user with ID 3 exists and has name 'Alice'?
A{"user_id":3,"username":"Alice"}
B{"id":3,"name":"Alice"}
CUser 3 not found
DError 404
Step-by-Step Solution
Solution:
  1. Step 1: Understand typical GET response format

    GET returns JSON with resource fields matching API design.
  2. Step 2: Match response to user data

    Correct JSON includes id and name fields with values 3 and 'Alice'.
  3. Final Answer:

    {"id":3,"name":"Alice"} -> Option B
  4. Quick Check:

    GET response body = JSON with id and name [OK]
Quick Trick: GET returns JSON data matching resource fields [OK]
Common Mistakes:
  • Using wrong field names
  • Returning error when user exists
  • Returning plain text instead of JSON

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes