Bird
0
0

What will be the result of sending two identical PUT requests to update a user's name?

medium📝 Predict Output Q5 of 15
Rest API - HTTP Methods
What will be the result of sending two identical PUT requests to update a user's name?
PUT /users/5 {"name": "Alice"}
PUT /users/5 {"name": "Alice"}
AThe server returns an error on second request
BThe user's name changes twice
CThe user's name is deleted after second request
DThe user's name changes once, second request has no effect
Step-by-Step Solution
Solution:
  1. Step 1: Understand PUT idempotency

    PUT replaces the resource with the same data each time, so repeated requests do not change the state after the first.
  2. Step 2: Analyze effect of two identical PUTs

    The first request updates the name; the second request sets the same name again, causing no change.
  3. Final Answer:

    The user's name changes once, second request has no effect -> Option D
  4. Quick Check:

    Repeated PUT = same resource state [OK]
Quick Trick: PUT with same data repeated does not change resource again [OK]
Common Mistakes:
  • Thinking name changes twice
  • Expecting deletion after second PUT
  • Assuming error on second PUT

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes