Rest API - URL and Resource DesignWhich of the following is the correct nested URL format to get comments of a post with ID 5?A/comments/5/postsB/comments/posts/5C/posts/5/commentsD/posts/comments/5Check Answer
Step-by-Step SolutionSolution:Step 1: Identify parent and child in URLThe parent is 'posts' with ID 5, and the child is 'comments'. The child comes after the parent.Step 2: Check URL structureThe correct format is /parent/{parent_id}/child, so /posts/5/comments is correct.Final Answer:/posts/5/comments -> Option CQuick Check:Parent ID before child resource [OK]Quick Trick: Parent resource and ID come before child resource in URL [OK]Common Mistakes:MISTAKESPlacing child resource before parentSwapping IDs and resource namesUsing incorrect order of URL segments
Master "URL and Resource Design" in Rest API9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Rest API Quizzes HTTP Methods - Idempotency of methods - Quiz 15hard HTTP Status Codes - 200 OK and 201 Created - Quiz 9hard HTTP Status Codes - 429 Too Many Requests - Quiz 12easy HTTP Status Codes - 429 Too Many Requests - Quiz 5medium HTTP Status Codes - 200 OK and 201 Created - Quiz 1easy Query Parameters and Filtering - Filtering by field values - Quiz 6medium REST API Fundamentals - First API request and response - Quiz 7medium URL and Resource Design - Avoiding verbs in URLs - Quiz 15hard URL and Resource Design - Resource identifiers in URLs - Quiz 1easy URL and Resource Design - Noun-based resource naming - Quiz 1easy