Bird
0
0

You have an API endpoint defined as GET /users/ to get a list of users and GET /user/{id} to get a single user. A developer mistakenly uses GET /user/ to get all users. What is the likely problem?

medium📝 Debug Q14 of 15
Rest API - URL and Resource Design
You have an API endpoint defined as GET /users/ to get a list of users and GET /user/{id} to get a single user. A developer mistakenly uses GET /user/ to get all users. What is the likely problem?
AThe endpoint <code>/user/</code> is incorrect for list retrieval and may cause a 404 error.
BThe endpoint <code>/user/</code> will return a list of users anyway.
CThe endpoint <code>/user/</code> will return a single user without ID.
DThe endpoint <code>/user/</code> will automatically redirect to <code>/users/</code>.
Step-by-Step Solution
Solution:
  1. Step 1: Understand endpoint naming conventions

    List retrieval requires plural resource name, so /users/ is correct for all users.
  2. Step 2: Analyze the incorrect usage

    /user/ is singular and without an ID, so it likely does not exist or returns an error like 404.
  3. Final Answer:

    The endpoint /user/ is incorrect for list retrieval and may cause a 404 error. -> Option A
  4. Quick Check:

    Singular without ID ≠ list endpoint [OK]
Quick Trick: Singular without ID usually causes errors for list requests [OK]
Common Mistakes:
  • Using singular endpoint for list retrieval
  • Assuming singular endpoint returns list
  • Expecting automatic redirects between endpoints

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes