QuestionQ428

Using APIs

Drag the code snippets from the bottom into the blanks in the Python script to retrieve a list of network devices using the Cisco Catalyst Center (formerly DNA Center) API. Not every option is needed.

Drag & Drop
api
put
get
url
token
post
def
def network_device_list(dnac, token):
    url = "https://{host_ip}//v1/network-device".format(dnac['host'])
    headers = {"x-auth-token": }
    response = requests.(, headers=headers, verify=False)
    data = response.json()
Explanation

The network-device collection is retrieved with an HTTP GET request to the api/v1/network-device endpoint. The bearer authentication value supplied by Cisco Catalyst Center is sent through the x-auth-token request header, and the URL variable contains the endpoint passed to requests.get.

Community Discussion

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