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:
Step 1: Recognize the correct URL path format
Resource identifiers appear as a path segment after the resource name, separated by a slash.
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.
Final Answer:
/users/123 -> Option D
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
Master "URL and Resource Design" in Rest API
9 interactive learning modes - each teaches the same concept differently