Courseiva

200-901 Understanding and Using APIs Practice Question

A network engineer is using the Cisco DNA Center API to retrieve a list of all sites. The API response is a JSON object with a 'response' array containing site objects. The engineer wants to extract the name of each site. Which Python code snippet correctly parses the JSON response and prints each site name?

⚠ Common exam trap

The trap here is assuming that the API response directly contains a list of sites or that the top-level object has a 'name' field, rather than nesting the data under 'response'.

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

✓

for site in response.json()['response']: print(site['name'])

The Cisco DNA Center API returns site data within a top-level 'response' array. To print each site name, the code must parse the JSON, access the 'response' list, iterate over each site dictionary, and print the 'name' value. The correct snippet does exactly that, while the others either misidentify the key or attempt to iterate over the wrong 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.

  • ✗

    for site in response.json(): print(site['name'])

    Why it's wrong here

    This snippet attempts to iterate over the top-level JSON object directly, which is a dictionary, not a list of sites. Iterating over a dictionary yields its keys (strings), so trying to access site['name'] would raise a TypeError. The correct approach is to first access the 'response' key to get the list of sites.

  • ✗

    print(response.json()['name'])

    Why it's wrong here

    This snippet tries to access a 'name' key directly on the top-level JSON object. However, the DNA Center API response does not have a top-level 'name' field; it contains a 'response' array. This would result in a KeyError. The engineer must navigate into the 'response' array to find individual site names.

  • ✗

    for site in response.json()['sites']: print(site['name'])

    Why it's wrong here

    This snippet looks for a 'sites' key in the JSON response, but the Cisco DNA Center API uses 'response' as the key for the array of sites. Using 'sites' would cause a KeyError. It is crucial to use the exact key name returned by the API, which is 'response' in this case.

  • ✓

    for site in response.json()['response']: print(site['name'])

    Why this is correct

    This snippet correctly accesses the 'response' key from the parsed JSON and iterates over the list of site objects, printing the 'name' field of each. The Cisco DNA Center API returns a JSON object with a top-level 'response' key containing an array of site details, so this approach accurately extracts the required information.

About these practice questions

Courseiva writes every 200-901 question from scratch — 975 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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 200-901 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 200-901 exam.