Bird
0
0

Which of the following URLs correctly uses a resource identifier for an order with ID 789?

easy📝 Conceptual Q2 of 15
Rest API - URL and Resource Design
Which of the following URLs correctly uses a resource identifier for an order with ID 789?
A/orders/789
B/orders?id=789
C/orders/order789
D/orders/789/details
Step-by-Step Solution
Solution:
  1. Step 1: Identify the standard REST URL pattern

    Resource identifiers usually appear as a path segment directly after the resource name, like /orders/789.
  2. Step 2: Evaluate each option

    /orders/789 matches the pattern. /orders?id=789 uses a query parameter, not a path ID. /orders/order789 appends ID incorrectly. /orders/789/details points to a sub-resource, not just the order.
  3. Final Answer:

    /orders/789 -> Option A
  4. Quick Check:

    Correct resource ID in path = /orders/789 [OK]
Quick Trick: Resource IDs go in URL path, not query for REST [OK]
Common Mistakes:
  • Using query parameters instead of path segments
  • Appending ID as part of resource name
  • Confusing sub-resources with main resource ID

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes