Bird
0
0

Which HTTP method is typically used to create a nested resource like a comment under a post?

easy📝 Conceptual Q2 of 15
Rest API - URL and Resource Design
Which HTTP method is typically used to create a nested resource like a comment under a post?
AGET
BPOST
CDELETE
DPUT
Step-by-Step Solution
Solution:
  1. Step 1: Identify HTTP method for creating resources

    POST is used to create new resources on the server.
  2. Step 2: Apply to nested resource creation

    To add a comment under a post, POST is sent to the nested URL like /posts/{id}/comments.
  3. Final Answer:

    POST -> Option B
  4. Quick Check:

    Creating nested resource = POST [OK]
Quick Trick: Use POST to create nested resources [OK]
Common Mistakes:
  • Using GET to create resources
  • Using DELETE or PUT incorrectly for creation
  • Confusing PUT with POST for new resource creation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes