Bird
0
0

Which of the following is the correct syntax for a hierarchical REST API path to access a user's specific post with ID 10?

easy📝 Syntax Q3 of 15
Rest API - URL and Resource Design
Which of the following is the correct syntax for a hierarchical REST API path to access a user's specific post with ID 10?
A/users/10/posts
B/users/posts/10
C/users/10/posts/10
D/posts/users/10
Step-by-Step Solution
Solution:
  1. Step 1: Understand the resource hierarchy

    User is the parent resource, posts is the child resource, and 10 is the post ID.
  2. Step 2: Identify the full path to a specific post

    The path must include user ID and post ID: /users/10/posts/10.
  3. Final Answer:

    /users/10/posts/10 -> Option C
  4. Quick Check:

    Specific child resource path = /users/10/posts/10 [OK]
Quick Trick: Include IDs for both parent and child to access specific nested resource [OK]
Common Mistakes:
  • Omitting the child resource ID
  • Swapping resource order
  • Using incomplete paths

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes