350-401 · Question #925
350-401 Question #925: Real Exam Question with Answer & Explanation
The correct answer is A: VlanNames['response']. Explanation Option A (VlanNames['response']) is correct because Cisco DNA Center (and similar REST APIs) typically return JSON data wrapped in a dictionary structure where the actual content is nested under a key called 'response'. When you make an API call and store the result,
Question
Refer to the exhibit. How should the programmer access the list of VLANs that were received via the API call?
Options
- AVlanNames['response']
- BVlanNames[0]
- CVlanNames['Vlan1']
- Dlist(VlanNames)
Explanation
Explanation
Option A (VlanNames['response']) is correct because Cisco DNA Center (and similar REST APIs) typically return JSON data wrapped in a dictionary structure where the actual content is nested under a key called 'response'. When you make an API call and store the result, the data is not stored directly at the top level - you must access the 'response' key to retrieve the list of VLANs.
Option B (VlanNames[0]) is wrong because using an integer index assumes VlanNames is a plain list, but it is actually a dictionary, so using [0] would raise a KeyError. Option C (VlanNames['Vlan1']) is incorrect because 'Vlan1' is a value within the response, not a top-level key of the returned dictionary. Option D (list(VlanNames)) simply converts the dictionary's keys into a list, which would return something like ['response'], not the actual VLAN data.
Memory Tip: Think of API responses like a wrapped gift 🎁 - the outer box is the dictionary, and you must open it with the 'response' key to get to the actual data inside. Whenever you see a Cisco API call result, always look for ['response'] first.
Topics
Community Discussion
No community discussion yet for this question.