200-901 · Question #402
Drag and Drop Question Refer to the exhibit. Drag and drop the code snippets from the bottom onto the blanks in the Python script to retrieve a list of network devices from Cisco DNA Center. Not all…
The correct answer is get_token(); x-auth-token; network-device; response.json(). This question tests knowledge of the Cisco DNA Center REST API authentication flow and HTTP request structure in Python, specifically how to authenticate using a token and call the network device inventory endpoint.
Question
Drag and Drop Question Refer to the exhibit. Drag and drop the code snippets from the bottom onto the blanks in the Python script to retrieve a list of network devices from Cisco DNA Center. Not all options are used. Answer:
Exhibit
Answer Area
Drag items
Correct arrangement
- get_token()
- x-auth-token
- network-device
- response.json()
Explanation
This question tests knowledge of the Cisco DNA Center REST API authentication flow and HTTP request structure in Python, specifically how to authenticate using a token and call the network device inventory endpoint.
Approach. Blank 1 calls get_token() to first obtain a Bearer/session token from DNA Center's /dna/system/api/v1/auth/token endpoint - authentication must happen before any API call. Blank 2 places that token in the 'x-auth-token' header, which is the proprietary header DNA Center requires (not the standard 'Authorization' header used by Bearer-token APIs). Blank 3 uses the 'network-device' path segment in the URL (GET /dna/intent/api/v1/network-device) to query the device inventory. Blank 4 calls response.json() to deserialize the JSON payload returned by the API into a Python dictionary, since DNA Center responds with JSON - not XML.
Concept tested. Cisco DNA Center REST API authentication and device inventory retrieval - specifically the two-step flow (obtain token via POST, then pass it via the 'x-auth-token' header), the correct inventory endpoint ('network-device'), and JSON response parsing in Python.
Reference. Cisco DNA Center Platform API Guide - Authentication and Network Device API (developer.cisco.com/docs/dna-center)
Topics
Community Discussion
No community discussion yet for this question.
