Bird
0
0

When using PUT to update a resource, what happens if some fields are missing in the request body?

easy📝 Conceptual Q2 of 15
Rest API - HTTP Methods
When using PUT to update a resource, what happens if some fields are missing in the request body?
AThe missing fields are deleted from the resource
BThe missing fields remain unchanged
CThe server returns an error
DThe missing fields are set to null automatically
Step-by-Step Solution
Solution:
  1. Step 1: Understand PUT replaces the entire resource

    PUT expects the full resource representation, so missing fields are removed.
  2. Step 2: Compare with PATCH behavior

    PATCH updates only specified fields, leaving others intact.
  3. Final Answer:

    The missing fields are deleted from the resource -> Option A
  4. Quick Check:

    PUT missing fields = deleted [OK]
Quick Trick: PUT replaces whole resource; missing fields get removed [OK]
Common Mistakes:
  • Assuming missing fields stay unchanged
  • Confusing PUT with PATCH behavior
  • Expecting server error on missing fields

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes