Bird
0
0

Which of the following is the correct way to structure a composite operation request in JSON?

easy📝 Syntax Q12 of 15
Rest API - Advanced Patterns
Which of the following is the correct way to structure a composite operation request in JSON?
A[{"method": "DELETE", "path": "/items/1"}]
B{"operation": "GET", "url": "/users"}
C{"requests": {"method": "POST", "endpoint": "/orders"}}
D{"operations": [{"method": "POST", "path": "/users"}, {"method": "PUT", "path": "/accounts/123"}]}
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct JSON structure for composite operations

    Composite operations usually use an "operations" array with each operation having "method" and "path" keys.
  2. Step 2: Compare options

    {"operations": [{"method": "POST", "path": "/users"}, {"method": "PUT", "path": "/accounts/123"}]} matches this structure exactly, while others use incorrect keys or formats.
  3. Final Answer:

    {"operations": [{"method": "POST", "path": "/users"}, {"method": "PUT", "path": "/accounts/123"}]} -> Option D
  4. Quick Check:

    Composite request = "operations" array with method and path [OK]
Quick Trick: Look for "operations" array with method and path keys [OK]
Common Mistakes:
MISTAKES
  • Using singular "operation" instead of plural "operations"
  • Using wrong keys like "url" or "endpoint"
  • Not wrapping operations inside an array

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes