Rest API - URL and Resource DesignWhich of the following is the correct syntax for a hierarchical resource path to access comments of a post with ID 10?A/posts/10/commentsB/comments/posts/10C/posts/comments/10D/10/posts/commentsCheck Answer
Step-by-Step SolutionSolution:Step 1: Identify the parent resource and its IDThe parent resource is 'posts' with ID 10, so it comes first in the path.Step 2: Append the child resourceComments belong to the post, so '/comments' follows '/posts/10'.Final Answer:/posts/10/comments -> Option AQuick Check:Parent resource + ID + child resource = /posts/10/comments [OK]Quick Trick: Parent resource and ID come before child resource [OK]Common Mistakes:Placing child resource before parentSwapping resource names and IDsUsing incorrect order of segments
Master "URL and Resource Design" in Rest API9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Rest API Quizzes HTTP Methods - GET for reading resources - Quiz 4medium HTTP Status Codes - Why status codes communicate outcomes - Quiz 10hard HTTP Status Codes - 429 Too Many Requests - Quiz 8hard HTTP Status Codes - 200 OK and 201 Created - Quiz 11easy Query Parameters and Filtering - Sorting with sort parameter - Quiz 6medium REST API Fundamentals - First API request and response - Quiz 13medium REST API Fundamentals - Client-server architecture - Quiz 9hard Request and Response Format - Error response format - Quiz 10hard Request and Response Format - Response envelope patterns - Quiz 14medium URL and Resource Design - Query parameters for filtering - Quiz 15hard