Refer to the exhibit.
How should the programmer access the list of VLANs that were received via the API call?
Refer to the exhibit.
How should the programmer access the list of VLANs that were received via the API call?
To access the list of VLANs received via the API call, the programmer should reference the 'response' key in the VlanNames dictionary. This is because the response from the API call is stored in a dictionary format, with 'response' being the key that holds the list of VLANs. Therefore, using VlanNames['response'] will return the list of VLANs.
>>> VlanNames = {'response':['vlan1','vlan2','vlan3'],'version':'1.0'} >>> VlanNames['response'] ['vlan1', 'vlan2', 'vlan3']
VlanNames -> Dictionary response -> Key ['vlan1','vlan2','vlan3'] -> Value
programmer not the network engineer !!!!!
VLAnNames is already a variable with value from the returned API calls so and print function showed it so to have access to it just list(VlanNames) will show it
It´s A The key 'response' contains the list of VLANs. To access this list, we need to use the key 'response' on the VlanNames dictionary.
...........................
As stated by Vlad already it is A. I got it labbed with Cisco's sandbox. url1 = "https://sandboxdnac.cisco.com/dna/intent/api/v1/topology/vlan/vlan-names" VlanNames = requests.get(url=url1, headers=headers, verify=False).json() print("\n\n",VlanNames['response']) ['Vlan1', 'Vlan101'] Process finished with exit code 0