Bird
0
0

What would be the correct nested URL to update comment 15 on post 8?

medium📝 Predict Output Q5 of 15
Rest API - URL and Resource Design
What would be the correct nested URL to update comment 15 on post 8?
A/comments/posts/8/15
B/comments/15/posts/8
C/posts/comments/15/8
D/posts/8/comments/15
Step-by-Step Solution
Solution:
  1. Step 1: Understand nested URL pattern

    The parent resource (post) comes first, then the child (comment), with their IDs in order.
  2. Step 2: Match the correct URL

    /posts/8/comments/15 correctly shows comment 15 nested under post 8.
  3. Final Answer:

    /posts/8/comments/15 -> Option D
  4. Quick Check:

    Update nested resource URL = /parent/{id}/child/{id} [OK]
Quick Trick: Parent resource ID first, then child resource ID [OK]
Common Mistakes:
MISTAKES
  • Swapping parent and child order
  • Placing IDs incorrectly
  • Using plural/singular inconsistently

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes