nerdexam
CiscoCisco

200-901 · Question #291

200-901 Question #291: Real Exam Question with Answer & Explanation

This question tests the ability to construct a curl command to interact with a REST API, specifically to retrieve a device count from Cisco DNA Center, by correctly identifying the HTTP method, URL components, and request headers from provided API documentation.

Understanding and Using APIs

Question

Drag and Drop Questions Refer to the exhibit. Drag and drop the code snippets from the bottom onto the blanks in the code to construct a request to find the Cisco DNA Center switch count. Not all options are used. Answer:

Explanation

This question tests the ability to construct a curl command to interact with a REST API, specifically to retrieve a device count from Cisco DNA Center, by correctly identifying the HTTP method, URL components, and request headers from provided API documentation.

Approach. To construct the correct curl request, we must refer to the API documentation in the first image.

  1. The first blank follows curl -L --request. The API documentation clearly states the HTTP method is 'GET'. Therefore, 'GET' should be dragged into the first blank.
  2. The second blank follows --. This is for specifying the URL. The standard curl option for the URL is --url. Thus, 'url' should be dragged into the second blank.
  3. The third blank is at the end of the URL: https://dna/intent/api/v1/network-device/ <blank>. From the API documentation, the full endpoint is /dna/intent/api/v1/network-device/count. Therefore, 'count' should be dragged into the third blank.
  4. The fourth blank is for the name of a header: --header '<blank> : application/json'. The Accept header is already specified. For a request sending or expecting JSON, Content-Type is a common header for specifying the format of the request body (even if empty for GET) or the expected response. Given the options, 'Content-Type' is the correct header name to specify application/json as the type of content being sent (or implicitly, the type of content expected if Accept wasn't also present). In this context, it often complements Accept.

Following these steps, the correct placement of the draggable options into the blanks is:

  • Blank 1: GET
  • Blank 2: url
  • Blank 3: count
  • Blank 4: Content-Type

Common mistakes.

  • common_mistake. 1. Using 'POST' instead of 'GET' for the request method: The API documentation explicitly labels the operation as 'GET /dna/intent/api/v1/network-device/count'. 'POST' is used for creating new resources, not for retrieving a count of existing resources. Selecting 'POST' would result in an incorrect request.
  1. Using 'network' instead of 'url' for the URL option: The curl command uses --url to specify the target URL. --network is not a standard curl option for this purpose.
  2. Placing 'network' in the URL path blank: The full API path is /dna/intent/api/v1/network-device/count. The blank in the curl command is specifically for the final segment 'count', not 'network'.
  3. Misunderstanding HTTP headers: While Accept: application/json is already provided, indicating the client expects a JSON response, the blank specifies an additional header with application/json. 'Content-Type' is the correct header name to specify the media type of the request body (even if empty for a GET request), or in some contexts, to reiterate the expected type. No other option fits as a valid HTTP header name in this context.

Concept tested. REST API interaction using curl, specifically understanding HTTP methods (GET), API endpoint structure, and common HTTP request headers (Content-Type, Accept), as well as interpreting API documentation.

Topics

#Cisco DNA Center API#REST API#HTTP GET#API endpoint

Community Discussion

No community discussion yet for this question.

Full 200-901 PracticeBrowse All 200-901 Questions