Bird
0
0

Given this JSON payload sent in a PATCH request for batch update:

medium📝 Predict Output Q13 of 15
Rest API - Batch and Bulk Operations
Given this JSON payload sent in a PATCH request for batch update:
[{"id":1,"status":"done"},{"id":2,"status":"pending"}]

What does this payload represent?
ARetrieve items with id 1 and 2.
BCreate two new items with given ids and statuses.
CDelete items with id 1 and 2.
DUpdate status of items with id 1 and 2 to 'done' and 'pending' respectively.
Step-by-Step Solution
Solution:
  1. Step 1: Analyze JSON payload

    The payload is an array of objects each with 'id' and 'status' fields, indicating updates.
  2. Step 2: Understand PATCH semantics

    PATCH updates existing items partially, so this changes status fields for items with id 1 and 2.
  3. Final Answer:

    Update status of items with id 1 and 2 to 'done' and 'pending' respectively. -> Option D
  4. Quick Check:

    PATCH with array updates multiple items [OK]
Quick Trick: PATCH with array updates multiple items by id [OK]
Common Mistakes:
MISTAKES
  • Thinking PATCH creates new items
  • Confusing update with delete
  • Assuming it retrieves data

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes