02-24-2022 09:39 AM
For a specific usecase, I need to get all wireless profiles from DNAC via API. The documentation (https://developer.cisco.com/docs/dna-center/#!get-wireless-profile) says that the /dna/intent/api/v1/wireless/profile should "Get either one or all the wireless network profiles if no name is provided for network-profile"
But when I issue the API call with an empty value for "profileName" I always get a "undefined" as response. Following you can see my test from DNACs toolkit page. I get the same result with postman.
Test Summary for "profileName" values:
- nothing submitted: "undefined"
- "asdf" submitted: "Profile Not Found"
- valid profile name submitted: Profile gets returned
Has anybody an idea, which value I need to enter, to get all wireless profiles returned?
Solved! Go to Solution.
03-04-2022 07:26 AM
After a lot of trial and error, I figured out, that for some reason my lab-DNAC doesn't like the /dna/intent/api/v1/wireless/profile call. If I do it on customers DNAC or on a dCloud DNAC the call works perfectly fine.
Thanks to everybody who tried helping me.
02-24-2022 10:18 AM
Hey Cedric,
Have you tried deleting the query param, and just using /dna/intent/api/v1/wireless/profile with no query?
I can't test right now unfortunately, so not sure if this works.
02-24-2022 11:02 AM
Hi Korey,
Yes i tried this with postman. Got the same repsonse (undefined)
I also tried calling out the param explicitly in the URL with https://DNAC/intent/api/v1/wireless/profile?profileName=null or with
https://DNAC/intent/api/v1/wireless/profile?profileName The first one give "Profile not Found" and the second one "undefined" as response back.
02-24-2022 11:21 AM
Cedric,
I'm using python not postman, but I was able to get it to work with:
02-24-2022 01:00 PM
Hi Korey
Unfortunately I still get "undefined" by calling https://{server}/dna/intent/api/v1/wireless/profile?
Would you mind sharing your whole sample script, so I can try figuring it out?
02-25-2022 04:45 AM
Sure, no problem. Here's what I tested with:
import requests import base64 def get_dna_token(): url = f'https://{server}/dna/system/api/v1/auth/token' payload = None auth = f'{username}:{password}'.encode() auth = base64.b64encode(auth).decode() headers = { "Content-Type": "application/json", "Authorization": f"Basic {auth}", "Accept": "application/json" } response = requests.post(url, headers=headers, data=payload, verify=False) token = response.json()['Token'] return token def get_wireless_profile(token): url = f'https://{server}/dna/intent/api/v1/wireless/profile?' payload = None headers = { "Content-Type": "application/json", "X-Auth-Token": f"{token}", "Accept": "application/json" } response = requests.get(url, headers=headers, data=payload, verify=False) print(response) response = response.json() return response def main(): token = get_dna_token() test = get_wireless_profile(token) print(test) if __name__ == '__main__': server = '1.1.1.1' username = 'test' password = 'test' requests.packages.urllib3.disable_warnings() main()
03-04-2022 07:26 AM
After a lot of trial and error, I figured out, that for some reason my lab-DNAC doesn't like the /dna/intent/api/v1/wireless/profile call. If I do it on customers DNAC or on a dCloud DNAC the call works perfectly fine.
Thanks to everybody who tried helping me.
03-05-2022 10:53 PM
03-06-2022 11:32 AM
Jep, but that didn't help. I'll update my DNAC to 2.2.3 to see if anything improves. Otherwise I'll have to open a TAC case I guess.
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