Exam 200-901 All QuestionsBrowse all questions from this exam
Question 82

Refer to the exhibit. A network engineer must manage the network devices. The engineer prepares a Python script to authenticate to the Cisco DNA Center API and request a device list. The device request fails and returns error code 401. Which action solves the problem?

    Correct Answer: C

    The device request fails with the error code 401, which signifies 'Unauthorized' access. This indicates that the request to obtain the device list lacks proper authentication. The authentication token, which is acquired in the initial request (token request), should be included in the request header for subsequent API calls. Updating the headers to include the Authorization token in the request when obtaining the device list will authenticate the request and allow access to the device information.

Discussion
czifraj2Option: C

Its's C because we got a token but not used.

mellohelloOption: C

In the provided code, the authentication token is being requested and stored in the "token" variable, but it is not being included in the subsequent request for the device list. To solve the problem, the authentication token should be included in the request header as an "Authorization" field. For example: headers = {'Content-Type': 'application/json', 'Authorization': f'Bearer {token}'} This will include the necessary credentials in the request and allow it to be authenticated by the server.

anagy11Option: C

Obtained token not used in the request for devices

sds85Option: C

/dna/system/api/v1/auth/token API to obtain an access token. The token obtained using this API is required to be set as value to the X-Auth-Token HTTP Header for all API calls to Cisco DNA Center.

sucre1Option: A

Since the HTTPBasicAuth description is correct The password is wrong. DNAC supports Basic Auth Base64 encoding https://developer.cisco.com/docs/dna-center/api/1-3-3-x/

Mongskeee

what if the error occurred on the request.post when getting the token due to incorrect credentials? how would we know if the error is due to the incorrect credentials or incorrect syntax due to header of the request.get doesn't contain the token/data?

herrmann69

It says "device request fails" which is the second request

CTshirtOption: C

It's C