nerdexam
Cisco

200-901 · Question #477

Refer to the exhibit. A software engineer needs to collect data about devices that are registered in Cisco DNA Center using the API. Before collecting the data, the engineer must obtain a token and…

The correct answer is A. get(uri,headers = headers,data={}, verify-True). Retrieving device inventory data from the Cisco DNA Center API requires an HTTP GET request with SSL verification enabled for secure communication.

Understanding and Using APIs

Question

Refer to the exhibit. A software engineer needs to collect data about devices that are registered in Cisco DNA Center using the API. Before collecting the data, the engineer must obtain a token and authenticate with the API. To automate the procedure, a Python script is used. Which code snippet must be placed onto the blank in the code?

Exhibit

200-901 question #477 exhibit

Options

  • Aget(uri,headers = headers,data={}, verify-True)
  • Bpost(uri,headers=headers,data={}, verify=False)
  • Cget(uri,headers= headers,data={}, verify=False)
  • Dpost(uri,headers=headers,data={"Basic"}, verify=False)

How the community answered

(30 responses)
  • A
    83% (25)
  • B
    3% (1)
  • C
    7% (2)
  • D
    7% (2)

Why each option

Retrieving device inventory data from the Cisco DNA Center API requires an HTTP GET request with SSL verification enabled for secure communication.

Aget(uri,headers = headers,data={}, verify-True)Correct

Fetching device data from the Cisco DNA Center inventory API uses an HTTP GET request because GET is the correct HTTP method for reading or retrieving resources without side effects. Using 'verify=True' enforces SSL certificate validation, which is the recommended secure practice when making API calls against a production DNA Center controller.

Bpost(uri,headers=headers,data={}, verify=False)

POST is used to create or submit data (such as requesting an auth token), not to retrieve existing device records from the DNA Center inventory API endpoint.

Cget(uri,headers= headers,data={}, verify=False)

GET is the correct method, but 'verify=False' disables SSL certificate validation, which introduces a security risk by allowing man-in-the-middle attacks and is not recommended for production use.

Dpost(uri,headers=headers,data={"Basic"}, verify=False)

Passing a literal 'Basic' string as the request body data is incorrect; Basic Auth credentials are encoded in the Authorization request header, not the body, and POST is not the appropriate method for data retrieval.

Concept tested: Cisco DNA Center REST API GET request with SSL verification

Source: https://developer.cisco.com/docs/dna-center/#!cisco-dna-2-3-7-x-api-overview

Topics

#Python requests library#API authentication#HTTP methods#Cisco DNA Center API

Community Discussion

No community discussion yet for this question.

Full 200-901 Practice