08-04-2023 07:04 AM
Hi guys
I am writing a script, which collects data from Cisco Spaces ("Visits reports") and enriches them with information from Cisco DNAC via API.
Most of the time, the MAC addresses from Cisco Spaces can be found via API and "/dna/intent/api/v1/client-detail?macAddress=8c:55:4a:db:45:11", especially the detail > vlanID information is of interest for us
For certain MAC addresses, Cisco DNAC API does not return a VLAN ID:
How can I access this kind of information from Cisco DNAC API?
Thanks in advance and best regards
Dominic
Solved! Go to Solution.
08-09-2023 01:45 AM
Okay, last resort: Use the internal API. You can use the same login mechanism (and X-Auth-Token) as with the normal API and the following API endpoint + payload:
Method+URL: POST https://{{DNAC}}/api/assurance/v1/host/client/detail
Payload:
{
"filters": {
"macAddress": "8c:55:4a:db:45:11"}
}
08-06-2023 06:27 AM
Hi Dominic, can you confirm, you just use the "macAddress" parameter in your query and don't use the "timestamp" param in your query?
08-06-2023 08:41 AM
Hi Marcel
I can confirm, I used both options:
First: only with the macAddress param
https://x.x.x.x/dna/intent/api/v1/client-detail?macAddress=8c:55:4a:db:45:11
Second: added the timestamp in epoch milliseconds as well:
https://x.x.x.x/dna/intent/api/v1/client-detail?macAddress=8c:55:4a:db:45:11×tamp=1689058800000
Regards
Dominic
08-06-2023 10:56 PM - edited 08-06-2023 10:57 PM
I'm asking because I get that 1005-error when querying a mac and providing in addition a wrong timestamp (for example for a time, when the client was not yet connected). But this, seems not be the issue in your case.
By debugging it looks like DNAC-UI using internal API calls to collect the corresponding client-information, that might explain why there are differences between the UI and the official API.
Can you try to query the MAC via GET /dna/intent/api/v1/client-enrichment-details you need to provide the parameters via the HEADER (not via query params):
entity_type: mac_address
entity_value: 8c:55:4a:db:45:11
08-06-2023 11:30 PM - edited 08-06-2023 11:30 PM
Hi Marcel
> I'm asking because I get that 1005-error when querying a mac and providing in addition a wrong timestamp (for example for a time, when the client was not yet connected). But this, seems not be the issue in your case.
I do get the error (errorCode = 1005), when using the query without the timestamp param and even when using a correct timestamp param (I do know, when the client should have been online based on the Cisco Spaces information).
> Can you try to query the MAC via GET /dna/intent/api/v1/client-enrichment-details you need to provide the parameters via the HEADER (not via query params)
Thanks for this hint, I will try it later and will post the results back in this post.
Regards
Dominic
08-08-2023 02:36 AM
Hi Marcel
just tried the /dna/intent/api/v1/client-enrichment-details call and specified the params in the header. I get some client information there, but unfortunately the vlanId and hostIpV4 attributes are null as well.
But anyhow, thanks for the hint with this additional API call.
Best regards
Dominic
08-09-2023 01:45 AM
Okay, last resort: Use the internal API. You can use the same login mechanism (and X-Auth-Token) as with the normal API and the following API endpoint + payload:
Method+URL: POST https://{{DNAC}}/api/assurance/v1/host/client/detail
Payload:
{
"filters": {
"macAddress": "8c:55:4a:db:45:11"}
}
08-10-2023 06:18 AM
Thanks a lot Marcel, this works perfect as a (second) alternative:
First way: official API (https://{dnac}/dna/intent/api/v1/client-detail) with mac address as param and getting vlanId
1. Alternative way: official API (https://{dnac}/dna/intent/api/v1/client-detail) with mac address as param and getting hostIPv4 (get VLAN ID based on IP subnet)
2. Alternative way: your option above
Thanks a lot for your kind effort!
Best regards
Dominic
08-10-2023 06:24 AM
Hi Dominic, I'm glad I could help.
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