Bird
0
0

Which of the following is the correct way to include a resource identifier for a user with ID 42 in a REST API URL?

easy📝 Syntax Q12 of 15
Rest API - URL and Resource Design
Which of the following is the correct way to include a resource identifier for a user with ID 42 in a REST API URL?
A/users#42
B/users?id=42
C/users/42/details
D/users/42
Step-by-Step Solution
Solution:
  1. Step 1: Identify the standard REST URL format

    Resource identifiers usually come directly after the resource name separated by a slash.
  2. Step 2: Check each option

    /users/42 uses "/users/42" which correctly places the ID after the resource name. /users?id=42 uses a query parameter, which is less common for resource identification. /users/42/details adds extra path which may refer to a sub-resource. /users#42 uses a fragment which is not for resource IDs.
  3. Final Answer:

    /users/42 -> Option D
  4. Quick Check:

    Resource ID follows resource name with slash [OK]
Quick Trick: Resource ID follows resource name with a slash / [OK]
Common Mistakes:
  • Using query parameters instead of path segments
  • Adding extra path parts that change meaning
  • Using URL fragments (#) for resource IDs

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes