Bird
0
0

How would you show an example request to update a user's email using a PATCH method in REST API?

hard📝 Application Q9 of 15
Rest API - API Documentation

How would you show an example request to update a user's email using a PATCH method in REST API?

Choose the correct example request body.
A{ "user": { "email": "new.email@example.com" } }
B{ "email": "new.email@example.com" }
C[ "email": "new.email@example.com" ]
D"email": "new.email@example.com"
Step-by-Step Solution
Solution:
  1. Step 1: Understand PATCH request body format

    PATCH usually sends only fields to update as a JSON object.
  2. Step 2: Identify correct JSON syntax for partial update

    { "email": "new.email@example.com" } is a simple JSON object with the email field, which is correct.
  3. Final Answer:

    { "email": "new.email@example.com" } -> Option B
  4. Quick Check:

    PATCH body = partial JSON object [OK]
Quick Trick: PATCH sends only fields to update as JSON object [OK]
Common Mistakes:
MISTAKES
  • Wrapping fields unnecessarily in extra objects
  • Using array syntax instead of object
  • Omitting braces around JSON

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes