Bird
0
0

Identify the error in this REST API call: POST /users/123 with body {"name": "Bob"} to update user name.

medium📝 Debug Q6 of 15
Rest API - REST API Fundamentals
Identify the error in this REST API call: POST /users/123 with body {"name": "Bob"} to update user name.
ABody must be empty for update requests
BURL should not include user ID for update
CPOST is correct; no error
DPOST is incorrect; should use PUT or PATCH for update
Step-by-Step Solution
Solution:
  1. Step 1: Understand HTTP methods for REST updates

    POST is usually for creating resources. PUT or PATCH are used to update existing resources.
  2. Step 2: Check the method used for updating user

    Using POST to update user 123 is incorrect; PUT or PATCH should be used instead.
  3. Final Answer:

    POST is incorrect; should use PUT or PATCH for update -> Option D
  4. Quick Check:

    Update uses PUT/PATCH, not POST [OK]
Quick Trick: Use PUT or PATCH to update resources in REST [OK]
Common Mistakes:
MISTAKES
  • Using POST for updates
  • Ignoring resource ID in URL
  • Sending empty body for updates

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes