Courseiva
easyMultiple Choice

350-401 Practice Question: Is using the Cisco DNA Center REST API to…

A network engineer is using the Cisco DNA Center REST API to retrieve the health score of a specific device. The API response is as follows:

{
  "response": [
    {
      "deviceId": "1234567890",
      "hostname": "Core-Switch-1",
      "score": 8,
      "overallHealth": "good",
      "timestamp": 1623456789
    }
  ],
  "version": "1.0"
}

The engineer wants to extract the 'overallHealth' value. Which Python code correctly extracts it?

⚠ Common exam trap

350-401 often tests basic JSON parsing in Python, tricking candidates who forget that the 'response' key maps to a list and try to index it as a dictionary or skip the list index entirely.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

health = response['response'][0]['overallHealth']

The JSON response has a top-level key 'response' whose value is a list containing one dictionary. To extract 'overallHealth', you must index into the list first: response['response'][0]['overallHealth']. This correctly navigates the nested structure. The other options either skip the list indexing or assume a different structure.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    health = response['response'][0]['overallHealth']

    Why this is correct

    Indexing the JSON object by key retrieves the nested value directly: `response['response']` yields the list, `[0]` selects its single dictionary element, and `['overallHealth']` returns `"good"`. This satisfies the stem's requirement to extract the health status from the parsed API response without iterating.

  • ✗

    health = response['overallHealth']

    Why it's wrong here

    'overallHealth' sits inside the object nested within the 'response' array, not at the document root, so this lookup raises a KeyError. Direct key access works when the API returns a flat object; this payload wraps the device data in an array under 'response'.

  • ✗

    health = response['response']['overallHealth']

    Why it's wrong here

    'response' maps to a JSON array, so indexing it with the string 'overallHealth' raises a TypeError rather than returning the value. Bracket notation with a key is correct only for objects; here the array must first be indexed, as in response['response'][0]['overallHealth'].

  • ✗

    health = response[0]['overallHealth']

    Why it's wrong here

    Indexing the root document with [0] fails because the top level is an object keyed by 'response' and 'version', not an array. Positional indexing is correct when the API returns a bare JSON array; here the device object must be reached through response['response'][0] first.

Go deeper

Related to this question

About these practice questions

This 350-401 question is part of Courseiva's 1,923-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Cisco exam blueprint

This 350-401 practice question is part of Courseiva's free Cisco certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 350-401 exam.