Rest API - URL and Resource DesignWhich HTTP method is typically used to create a nested resource like a comment under a post?AGETBPOSTCDELETEDPUTCheck Answer
Step-by-Step SolutionSolution:Step 1: Identify HTTP method for creating resourcesPOST is used to create new resources on the server.Step 2: Apply to nested resource creationTo add a comment under a post, POST is sent to the nested URL like /posts/{id}/comments.Final Answer:POST -> Option BQuick Check:Creating nested resource = POST [OK]Quick Trick: Use POST to create nested resources [OK]Common Mistakes:Using GET to create resourcesUsing DELETE or PUT incorrectly for creationConfusing PUT with POST for new resource creation
Master "URL and Resource Design" in Rest API9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Rest API Quizzes HTTP Methods - POST for creating resources - Quiz 8hard HTTP Methods - PATCH for partial updates - Quiz 8hard HTTP Methods - POST for creating resources - Quiz 4medium HTTP Methods - Idempotency of methods - Quiz 9hard HTTP Status Codes - 422 Unprocessable Entity - Quiz 15hard Query Parameters and Filtering - Filtering by field values - Quiz 1easy REST API Fundamentals - REST vs SOAP vs GraphQL comparison - Quiz 7medium REST API Fundamentals - First API request and response - Quiz 1easy REST API Fundamentals - REST constraints and principles - Quiz 6medium Request and Response Format - Request body structure - Quiz 4medium