import requests
headers = {"X-Cisco-Meraki-API-Key": "KEY1234"}
BASE_URL = "https://api-mp.meraki.com/api/v1"
FIRST_URL = "/organizations"
SECOND_URL = "/networks"
THIRD_URL = "clients"
def first_loop(info):
for item in info:
if item["name"] == "ACME":
URL = BASE_URL + FIRST_URL + "/" + item["id"] + "/" + SECOND_URL
response = requests.request("GET", URL, headers=headers)
return second_loop(response.json())
def second_loop(info):
for item in info:
if item["name"} == "BLDG21":
URL = BASE_URL + SECOND_URL + "/" + item["id"] + "/" + THIRD_URL
response = requests.request("GET", URL, headers=headers)
return third_loop(response.json())
def third_loop(info):
for item in info:
return item
response = requests.request("GET", BASE_URL + FIRST_URL, headers=headers)
info = first_loop(response.json())
for item in info:
print (item["id"])
A network engineer must collect information from the network. The engineer prepares a script to automate workflow by using Cisco Meraki API. The script must run over nested loops to collect organization and network information and uses the collected data for final collection. Which process is being automated by using the Python script?
A.
Collect the IDs of the clients on the BLDG21 network.
B.
List the IDs from the ACME organization.
C.
Provide the BLDG21 network information if it is part of the ACME organization.
D.
Gather the IDs of the ACME organization, the BLDG21 network, and the clients on the network.