Bird
0
0

Which JSON snippet correctly represents a composite operation request to update a user's email and delete a post?

easy📝 Syntax Q3 of 15
Rest API - Advanced Patterns
Which JSON snippet correctly represents a composite operation request to update a user's email and delete a post?
A{ "batch": [ { "method": "POST", "path": "/users/45", "body": { "email": "new@example.com" } }, { "method": "DELETE", "path": "/posts/99" } ] }
B{ "actions": [ { "type": "UPDATE", "endpoint": "/users/45", "data": { "email": "new@example.com" } }, { "type": "REMOVE", "endpoint": "/posts/99" } ] }
C{ "requests": [ { "verb": "PUT", "url": "/users/45", "payload": { "email": "new@example.com" } }, { "verb": "DELETE", "url": "/posts/99" } ] }
D{ "operations": [ { "method": "PATCH", "path": "/users/45", "body": { "email": "new@example.com" } }, { "method": "DELETE", "path": "/posts/99" } ] }
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct composite operation format

    Standard composite requests use an "operations" array with each operation specifying "method", "path", and optionally "body".
  2. Step 2: Analyze options

    { "operations": [ { "method": "PATCH", "path": "/users/45", "body": { "email": "new@example.com" } }, { "method": "DELETE", "path": "/posts/99" } ] } matches the expected structure with correct HTTP methods and keys.
  3. Final Answer:

    { "operations": [ { "method": "PATCH", "path": "/users/45", "body": { "email": "new@example.com" } }, { "method": "DELETE", "path": "/posts/99" } ] } is the correct JSON structure.
  4. Quick Check:

    Check for "operations" array and valid HTTP methods [OK]
Quick Trick: Look for 'operations' array with 'method' and 'path' keys [OK]
Common Mistakes:
MISTAKES
  • Using incorrect keys like 'actions' or 'requests' instead of 'operations'
  • Using invalid HTTP methods like 'REMOVE'
  • Misnaming fields such as 'endpoint' or 'url' instead of 'path'

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes