08-22-2023 01:26 AM
I couldnt find anything in the documentation or on the community forum, and struggled to find what I was looking for elsewhere.
I'm building out a monitoring solution for DNA Center using the Rest API and my get queries only need to return a specific field, eg:
For Get-Site I need to only return these 3 attributes in separate queries
Query1: ID - https://dnac_url/dna/intent/api/v1/site?fields=id
Query2: Name - https://dnac_url/dna/intent/api/v1/site?fields=name
Query3: Type - https://dnac_url/dna/intent/api/v1/site?fields=type
Other Rest API's I've used have followed this syntax, but it doesnt seem to work on DNA Center. Any help would be much appreciated.
08-22-2023 07:40 AM
you may need to authenticate first ? Get started with Authentication API - Postman - Cisco DevNet Learning Center
and for the obvious dnac_url resolves to the actual url/address (VIP) of your DNA's cluster ?
08-22-2023 07:52 AM
Thanks for the reply. I'm authenticated and get run anything from the examples: For instance:
https://dnac_url/dna/intent/api/v1/site
Obviously it returns all of the sites. But I dont want all the info, I just need to limit it to Name or ID or Type.
08-22-2023 08:04 AM - edited 08-22-2023 08:05 AM
in the sample template the syntax is:
https:///dna/intent/api/v1/site?name=null&siteId=null&type=null&offset=1&limit=500
I'd suggest you need https:///dna/intent/api/v1/site?name=null
to only retrieve all names ? (and only names without siteid and type)
08-23-2023 02:24 AM
Where did you find that sample?
When I try it I get:
{
"message": [
"The input site is not valid or site is not present."
],
"response": []
}
08-23-2023 03:36 AM
this comes from :
Cisco Developer and DevNet: APIs, SDKs, Sandbox, and Community for software developers and network engineers
in left pane search for get site (nb it shows hits for multiple API versions, which may vary)
on the most right pane (configuration) open parameters tab and switch on parameters
you can delete the parameters you do not need to construct the template
then open the template tab and open the curl/python/Nodejs variants as needed
When searching some more, as it is an array, you may need ?fileds=response[name]
08-23-2023 05:36 AM
Nope that didnt work, I tried a few variations of response[name] and additionalInfo[name], but nothing worked.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide