Question 17 of 32 from exam 300-635-DCAUTO: Automating and Programming Cisco Data Center Solutions

Question 17 of 32 from exam 300-635-DCAUTO: Automating and Programming Cisco Data Center Solutions

Question

DRAG DROP - Drag and drop the correct code snippets into the Python code to create a new application profile "WebApp" using the ACI REST API.

Not all options are used.

Select and Place:

import requests

response = requests.post (
‘https: //apic/api/aaatiogin. json",
json={"aaaser": ("attributes™
verity=False)

(Thame": admin", "pwd!

“ciscopsdt}}},

token = response. json(){"imdata'] [0] {‘aaaLogin'] {*attributes*] ("token")
url = ‘https: //apic' /api/mo/uni/tn-MyCompany. xml"

headers = {'Content-Type': *text/xm1")
cookie = (*APIC-cookie': token}

sponse =

print (response.text)

payload = {
‘“fvtenant™ :("name": "MyCompany"},
“EvApp": "Webapp™ })

requests.request ("POST", url, data-payload,
headers=headers, cookies=cookie,
verify-False)

payload = '<fvAp name="WebApp” />!

payload = '<fvAp name="MyCompany/WebApp" >"

requests.request ("POST", url, data=payload,
headers=('Content-Type': "application/json'},
veri fy=False)

requests.request ("PATCH", url, data=payload,
headerssheaders, cookies=cookie,
veri fy=False)

Explanations

import requests

response = requests.post (
‘https: //apic/api/aaatogin. json",

json={"aaaUser": {"attributes": ("name": "admin", pwd’

verify=False)

“ciscopsdt}}},

token = response. json(){"imdata'] [0] {‘aaaLogin'] {*attributes*] ("token")
url = ‘https: //apic' /api/mo/uni/tn-MyCompany. xml"

payload = {
‘“fvtenant™ :("name": "MyCompany"},
“EvApp": "Webapp™ })

headers = {"Content~Type': ‘text /xal')
cookie = (*APIC-cookie': token)

requests.request ("POST", url, data-payload,

headers-headers, cookies=cookie,

response =
verify=False)

print (response.text)

payload = {
“fvTenant™ :{"name": "MyCompany"},
“fvapp": "WebApp" ))

requests.request ("POST", url, data-payload,
headers=headers, cookies=cookie,
verify-False)

payload = '<fVvAp name="WebApp" />"

payload = '<fvAp name="MyCompany/WebApp" >"

requests.request ("POST", url, data=payload,
headers=('Content-Type': "application/json'},
veri fy=False)

requests.request ("PATCH", url, data=payload,
headerssheaders, cookies=cookie,
veri fy=False)