300-435 · Question #50
The Cisco DNA Center Sites API must be used to add a device to a site, but only the site name is available. Which API call must be used to retrieve the site identifier so that the device can be…
The correct answer is C. /dna/intent/api/v1/site. To retrieve a site identifier when only the site name is known in Cisco DNA Center, the API call GET /dna/intent/api/v1/site should be used to list all sites, then filter the response by name to extract the corresponding ID.
Question
Exhibit
Options
- A/dna/intent/api/site/siteId
- B/dna/intent/api/sites
- C/dna/intent/api/v1/site
- D/dna/intent/api/v1/site/siteName
How the community answered
(55 responses)- A4% (2)
- B2% (1)
- C89% (49)
- D5% (3)
Why each option
To retrieve a site identifier when only the site name is known in Cisco DNA Center, the API call `GET /dna/intent/api/v1/site` should be used to list all sites, then filter the response by name to extract the corresponding ID.
The `/dna/intent/api/site/siteId` endpoint is designed to retrieve details for a specific site when its unique `siteId` is already known, not to list sites or find an ID by name.
While `/dna/intent/api/sites` might seem plausible, the standard and documented base path for Site APIs in Cisco DNA Center's current API version is `/dna/intent/api/v1/site`.
The `GET /dna/intent/api/v1/site` API call is used to retrieve a list of all sites managed by Cisco DNA Center, and the response contains both the `id` and `name` for each site, allowing the user to programmatically find the required site identifier by matching the known site name.
REST API best practices typically use unique identifiers in the path (like `siteId`), while filtering by attributes like `siteName` is usually done via query parameters, making this path structure unlikely for retrieving a site by name directly.
Concept tested: Cisco DNA Center Sites API GET all
Source: https://developer.cisco.com/dnac/api/v1/site/get-all-sites/
Topics
Community Discussion
No community discussion yet for this question.
