Bird
0
0

Given a batch create endpoint that returns a list of created resource IDs, what will be the response if the input is [{"name": "Tom"}, {"name": "Jerry"}] and both are valid?

medium📝 Predict Output Q4 of 15
Rest API - Batch and Bulk Operations
Given a batch create endpoint that returns a list of created resource IDs, what will be the response if the input is [{"name": "Tom"}, {"name": "Jerry"}] and both are valid?
A{"created_ids": []}
B{"error": "Invalid input"}
C{"created_id": 101}
D{"created_ids": [101, 102]}
Step-by-Step Solution
Solution:
  1. Step 1: Understand expected response for batch create

    When multiple valid items are created, the response usually includes all their IDs in a list.
  2. Step 2: Match response to input

    Input has two valid users, so response should list two IDs, as in {"created_ids": [101, 102]}.
  3. Final Answer:

    {"created_ids": [101, 102]} -> Option D
  4. Quick Check:

    Valid batch create returns list of IDs [OK]
Quick Trick: Batch create returns all created resource IDs in a list [OK]
Common Mistakes:
MISTAKES
  • Returning error on valid input
  • Returning empty list despite valid input
  • Returning single ID for multiple creations

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes