Bird
0
0

Given this PATCH request body:

medium📝 Predict Output Q4 of 15
Rest API - HTTP Methods
Given this PATCH request body:
{"email": "newemail@example.com"}

What will be the result if the server applies this PATCH to a user resource?
AThe entire user resource will be replaced with only the email field.
BOnly the email field of the user will be updated to the new value.
CThe server will delete the user resource.
DThe server will return an error because the PATCH body is incomplete.
Step-by-Step Solution
Solution:
  1. Step 1: Understand PATCH behavior with partial data

    PATCH updates only the fields provided, leaving others unchanged.
  2. Step 2: Analyze the given JSON body

    Only the email field is present, so only email changes.
  3. Final Answer:

    Only the email field of the user will be updated to the new value. -> Option B
  4. Quick Check:

    PATCH updates specified fields only [OK]
Quick Trick: PATCH changes only fields sent in request body [OK]
Common Mistakes:
  • Thinking PATCH replaces whole resource
  • Assuming PATCH deletes resource
  • Believing PATCH requires all fields

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes