QuestionQ16

Network Automation Foundation

Drag the appropriate code snippets into the Python code to create a new WebApp application profile by using the ACI REST API. Not every option is used.

Drag & Drop
import requests
response = requests.post(
    'https://apic/api/aaaLogin.json',
    json={"aaaUser": {"attributes": {"name": "admin","pwd": "ciscop@dt"}}},
    verify=False)
token = response.json()['imdata'][0]['aaaLogin']['attributes']['token']
url = 'https://apic/api/mo/uni/tn-MyCompany.xml'



headers = {'Content-Type': 'text/xml'}
cookie = {'APIC-cookie': token}

response = 

print(response.text)
Explanation

Cisco APIC creates configuration managed objects with an HTTP POST. The .xml managed-object endpoint and text/xml content type require an XML payload; <fvAp name="WebApp" /> creates the application profile under tenant MyCompany. The login token is supplied in the APIC-cookie session cookie on the subsequent POST request.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!