Bird
0
0

Which of the following is the correct syntax for a REST API URL with a resource identifier?

easy📝 Syntax Q3 of 15
Rest API - URL and Resource Design
Which of the following is the correct syntax for a REST API URL with a resource identifier?
A/users?123
B/users/123/profile
C/users#123
D/users/123
Step-by-Step Solution
Solution:
  1. Step 1: Recognize the correct URL path format

    Resource identifiers appear as a path segment after the resource name, separated by a slash.
  2. Step 2: Check each option's syntax

    /users/123 uses /users/123 which is correct. /users?123 uses a query symbol incorrectly. /users#123 uses a fragment identifier which is not for resource ID. /users/123/profile points to a sub-resource.
  3. Final Answer:

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

    Correct URL syntax = /resource/id [OK]
Quick Trick: Use slash to separate resource and ID in URL [OK]
Common Mistakes:
  • Using ? or # instead of / for IDs
  • Adding extra path segments when not needed
  • Confusing fragment with resource ID

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes