Bird
0
0

What will be the result of this HTTP request method usage?

medium📝 Predict Output Q13 of 15
Rest API - HTTP Methods
What will be the result of this HTTP request method usage?
PUT /items/123 HTTP/1.1
Content-Type: application/json

{"name": "New Item"}
Choose the correct description.
AIt retrieves the item with ID 123 without changes.
BIt updates or replaces the item with ID 123 with new data.
CIt deletes the item with ID 123 from the server.
DIt creates a new item without specifying an ID.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the PUT method purpose

    PUT is used to update or replace an existing resource at a specific URL.
  2. Step 2: Analyze the request details

    The request targets /items/123 with JSON data, meaning it updates item 123.
  3. Final Answer:

    It updates or replaces the item with ID 123 with new data. -> Option B
  4. Quick Check:

    PUT updates resource = C [OK]
Quick Trick: PUT replaces or updates resource at given URL [OK]
Common Mistakes:
MISTAKES
  • Thinking PUT retrieves data
  • Confusing PUT with DELETE
  • Assuming PUT creates without ID

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes