Bird
0
0

Which REST API path correctly represents accessing the reviews of a specific product with ID 42?

easy📝 Conceptual Q2 of 15
Rest API - URL and Resource Design
Which REST API path correctly represents accessing the reviews of a specific product with ID 42?
A/products/42/reviews
B/reviews/products/42
C/products/reviews/42
D/42/products/reviews
Step-by-Step Solution
Solution:
  1. Step 1: Identify the resource and sub-resource

    Product is the main resource, reviews are nested under it.
  2. Step 2: Match the correct hierarchical path format

    The path should be /products/{id}/reviews to show reviews of product 42.
  3. Final Answer:

    /products/42/reviews -> Option A
  4. Quick Check:

    Correct nested path = /products/42/reviews [OK]
Quick Trick: Parent resource ID comes before child resource name [OK]
Common Mistakes:
MISTAKES
  • Placing resource IDs after child resource names
  • Mixing order of resources
  • Using IDs without resource names

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes