Bird
0
0

How should you structure the response to clearly communicate partial success?

hard📝 Application Q15 of 15
Rest API - Batch and Bulk Operations
You design a REST API endpoint that processes a list of user updates. Some updates succeed, others fail due to validation errors. How should you structure the response to clearly communicate partial success?
AReturn HTTP 207 with a JSON array showing each user's update status and error if any
BReturn HTTP 400 with a generic error message for all failures
CReturn HTTP 200 with a simple success message ignoring failures
DReturn HTTP 500 with server error details
Step-by-Step Solution
Solution:
  1. Step 1: Identify the need for partial success reporting

    Since some updates succeed and others fail, the response must show both results clearly.
  2. Step 2: Choose appropriate HTTP status and response format

    HTTP 207 Multi-Status with detailed JSON per user update is the best practice to communicate partial success.
  3. Final Answer:

    Return HTTP 207 with a JSON array showing each user's update status and error if any -> Option A
  4. Quick Check:

    207 + detailed JSON = clear partial success [OK]
Quick Trick: Use 207 and detailed JSON for mixed success/failure results [OK]
Common Mistakes:
MISTAKES
  • Ignoring failed updates in response
  • Using 200 OK without details
  • Returning generic errors instead of per-item status

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes