Bird
0
0

A developer uses PATCH to update a user's phone number twice with the same data:

medium📝 Debug Q7 of 15
Rest API - HTTP Methods
A developer uses PATCH to update a user's phone number twice with the same data:
PATCH /users/7 {"phone": "123-456"}
PATCH /users/7 {"phone": "123-456"}

What is the likely issue here?
APATCH is idempotent, so no issue
BPATCH deletes the phone number on second call
CPATCH may cause side effects on repeated calls
DPATCH returns error on repeated requests
Step-by-Step Solution
Solution:
  1. Step 1: Understand PATCH method

    PATCH applies partial updates and is generally not guaranteed to be idempotent.
  2. Step 2: Analyze repeated PATCH calls

    Repeated PATCH requests may cause side effects like triggering events or logs multiple times.
  3. Final Answer:

    PATCH may cause side effects on repeated calls -> Option C
  4. Quick Check:

    PATCH not guaranteed idempotent = possible side effects [OK]
Quick Trick: PATCH can cause side effects; avoid repeated calls without checks [OK]
Common Mistakes:
MISTAKES
  • Assuming PATCH is idempotent
  • Expecting PATCH to delete data
  • Thinking PATCH errors on repeats

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes