Bird
0
0

Which of the following is the correct HTTP method and usage to fully replace a resource at URL /users/123 with new data in JSON format?

easy📝 Syntax Q12 of 15
Rest API - HTTP Methods
Which of the following is the correct HTTP method and usage to fully replace a resource at URL /users/123 with new data in JSON format?
APOST /users/123 with JSON body
BPUT /users/123 with JSON body
CPATCH /users/123 with JSON body
DGET /users/123 with JSON body
Step-by-Step Solution
Solution:
  1. Step 1: Identify method for full replacement

    PUT is the HTTP method used to fully replace a resource at a specific URL.
  2. Step 2: Match method with URL and body

    PUT /users/123 with JSON body replaces the user data fully. POST is for creation, PATCH partial update, GET retrieves.
  3. Final Answer:

    PUT /users/123 with JSON body -> Option B
  4. Quick Check:

    PUT + URL + JSON = full replace [OK]
Quick Trick: Use PUT with URL and full JSON body to replace resource [OK]
Common Mistakes:
  • Using POST instead of PUT for replacement
  • Using PATCH for full replacement
  • Sending body with GET request

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes