Bird
0
0

Why is it important to choose PATCH over PUT when updating just one field?

hard📝 Application Q15 of 15
Rest API - HTTP Methods
You have an API where PATCH /profile/123 updates only the email field of a user profile, while PUT /profile/123 replaces the entire profile. Why is it important to choose PATCH over PUT when updating just one field?
APATCH is faster because it sends less data
BPUT can accidentally erase other fields if not included
CPATCH creates a new profile instead of updating
DPUT is only for deleting resources
Step-by-Step Solution
Solution:
  1. Step 1: Understand the difference between PUT and PATCH

    PUT replaces the entire resource, so missing fields get erased. PATCH updates only specified fields.
  2. Step 2: Analyze the risk of using PUT for partial updates

    If you use PUT but omit some fields, those fields may be removed unintentionally.
  3. Final Answer:

    PUT can accidentally erase other fields if not included -> Option B
  4. Quick Check:

    Partial update safe = PATCH, full replace risk = PUT [OK]
Quick Trick: Use PATCH for partial updates to avoid data loss [OK]
Common Mistakes:
  • Thinking PATCH creates new resource
  • Believing PUT only deletes
  • Assuming PATCH sends no data

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes