Bird
0
0

What will the server respond with if a client sends a GET request to /users/123 and the user exists?

medium📝 Predict Output Q13 of 15
Rest API - REST API Fundamentals
What will the server respond with if a client sends a GET request to /users/123 and the user exists?
AA JSON object with user details
BAn error message saying 'User not found'
CA redirect to the homepage
DA blank page with no content
Step-by-Step Solution
Solution:
  1. Step 1: Understand GET request to resource

    A GET request to /users/123 asks for user data with ID 123.
  2. Step 2: Server response when user exists

    If user exists, server sends back user details, usually as JSON.
  3. Final Answer:

    A JSON object with user details -> Option A
  4. Quick Check:

    GET existing resource returns data [OK]
Quick Trick: GET returns data if resource exists, else error [OK]
Common Mistakes:
  • Assuming error if user exists
  • Thinking GET causes redirect
  • Expecting blank page on success

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes