Question 27 of 100 from exam 350-901-DEVCOR: Developing Applications Using Cisco Core Platforms and APIs

Question 27 of 100 from exam 350-901-DEVCOR: Developing Applications Using Cisco Core Platforms and APIs

Question

DRAG DROP - Drag and drop the expressions from below onto the code to implement error handling.

Not all options are used.

Select and Place:

Answer Area

base_url = “https://api.meraki.com/api/v0”
posturl = ‘%s/networks/%s/staticRoutes’ % ((str(base_url), str(networkid)))
headers = {
‘x-cisco-meraki-api-key’: api_key,
\Content-Type’: ‘application/json’
}
routes = [ {
“subnet”: “10.16.4.0/22”,
“gatewayIp”: “10.1.0.20",
“name”: “ROUTE1”,
“enabled”: true
1,
£
“subnet”: “10.253.254.0/24",
“gatewayIp”: “10.1.0.20”,
“name”: “ROUTE2”,
Yenabled”: true
},
{
“subnet”: “10.168.0.0/21",
“gatewayIp”: “10.1.0.20",
“name”: “ROUTE3”,
Yenabled”: true

#1

for route in routes:
print (“Adding static: “ + str(route[ ‘subnet’ ])
response = requests.post (posturl, json-route, headers-headers)

print (“Done!””)

print (“Failed to add static: “ + str(route[‘subnet’]) + “\n” + response. text)

ifresponse == 601 alse: when:

if response == 201 elif:

Explanations

Answer Area

base_url = “https://api.meraki.com/api/v0”
posturl = ‘%s/networks/%s/staticRoutes’ % ((str(base_url), str(networkid)))
headers = {
‘x-cisco-meraki-api-key’: api_key,
\Content-Type’: ‘application/json’
}
routes = [ {
“subnet”: “10.16.4.0/22”,
“gatewayIp”: “10.1.0.20",
“name”; “ROUTE1”,
Yenabled”: true
},
£
“subnet”: “10.253.254.0/24”,
“gatewayIp”: “10.1.0.20",
“name”: “ROUTE2”,
“enabled”: true
},
{
“subnet”: "10.168.0.0/21”,
“gatewayIp”: “10.1.0.20",
“name”: “ROUTE3”,
enabled”: true

#1

for route in routes:
print (“Adding static: “ + str(route[ ‘subnet’ ])
response = requests.post (posturl, json-route, headers-headers)

if response == 201
print (“Done!")

else:

print (“Failed to add static: “ + str(route[‘subnet’]) + “\n” + response. text)

ifresponse == 601 alse: when:

if response == 201 elif: