Which HTTP method is most appropriate for a batch create endpoint in a REST API?
Think about which method is used to create new resources.
POST is used to create new resources, including batch creation. GET is for reading, PUT is for replacing, and DELETE is for removing.
What is the correct HTTP status code returned after successfully creating multiple resources in a batch?
Consider the status code that indicates resource creation.
201 Created indicates that new resources were successfully created. 200 OK is general success, 204 No Content means success with no body, and 400 Bad Request means client error.
Given a batch create request that creates three new users, which response body best follows REST API best practices?
Request body:
[
{"name": "Alice"},
{"name": "Bob"},
{"name": "Charlie"}
]Think about returning the created resources with their new IDs.
Returning the full list of created resources with their IDs allows clients to know the details of what was created. Option D shows this. Option D only gives a count, C only URIs without details, and D just a message.
In a batch create endpoint, if some items fail validation but others succeed, what is the best practice for the response?
Think about how to communicate mixed results clearly.
207 Multi-Status allows the server to report success or failure for each item individually. This is best for partial success scenarios. 201 assumes all succeeded, 400 means all failed, and 500 is for server errors.
You want to design a batch create endpoint that is idempotent (safe to retry without creating duplicates). Which approach is best?
Think about how to identify repeated requests uniquely.
Idempotency means the same request can be repeated without side effects. Requiring a unique client-generated ID lets the server detect duplicates and avoid creating multiple copies. Option A allows duplicates, C is not idempotent, and D is incorrect HTTP method usage.