Bird
0
0

You receive this nested error response:

hard📝 Application Q8 of 15
Rest API - Error Handling

You receive this nested error response:

{
  "errors": {
    "profile": {
      "name": "Required",
      "contacts": {
        "email": "Invalid",
        "phone": "Missing"
      }
    }
  }
}
How would you extract all error messages for the contacts field?

AAccess errors.profile.contacts and collect all messages inside
BLook only at errors.contacts directly
CCheck errors.profile.name for contacts errors
DUse errors.contacts.phone only
Step-by-Step Solution
Solution:
  1. Step 1: Locate the contacts field inside profile

    The contacts errors are nested inside errors.profile.contacts as an object with multiple messages.
  2. Step 2: Extract all messages inside contacts

    Collect all values under contacts keys: "email" and "phone" messages.
  3. Final Answer:

    Access errors.profile.contacts and collect all messages inside -> Option A
  4. Quick Check:

    Nested extraction = access nested objects [OK]
Quick Trick: Access nested objects step-by-step to get errors [OK]
Common Mistakes:
  • Trying to access contacts at top level
  • Confusing profile name errors with contacts
  • Ignoring nested structure

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes