cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3067
Views
0
Helpful
8
Replies

Utilizing DNAC Intent APIs

Mike.Cifelli
VIP Alumni
VIP Alumni

Trying to start utilizing the intent API.  Following documentation has not helped me as I continue to get unauthorized while using linux curl tool.  I have attempted to follow the example code from within DNAC to obtain an authorization token, but have been unsuccessful.  I am familiar/experienced with using python to leverage ISE APIs.  Typically I will use the curl tool for the short and sweet gathering of strings that I then reference in my code.  Can anyone provide guidance on gathering the authz token so that I can begin working with other APIs?  Thanks in advance!

DNAC version 1.2.10.4

8 Replies 8

yawming
Cisco Employee
Cisco Employee

Which doc are you referring to that is not helping you ?

 

I think this simple introduction should explain how authorization  is used in DNA-C

https://developer.cisco.com/learning/lab/dnav3-dnac-nbapi-hello-world/step/1

 

Basically it s using Basic Auth 

The API url to use ti get token is "https://"+ip+"/dna/system/api/"+ver+"/auth/token"

 

To use the token for rest of api calls we need to put token in header

headers = {"X-Auth-Token": token}

 

Thanks,

 

Yawming

Here is what I am trying from linux CLI:
curl -k --request POST --url https://{IP ADDR}/dna/system/api/v1/auth/token --user '{USER}:{PASS}' --header 'content-type: application/json' --header 'Accept: application/json'
Continue to get unauthorized.

curl -k -u <username<:<password> -X POST https://dnacip/dna/system/api/v1/auth/token

 

It works

Thank you for the response. Still not working so I opened a TAC case. I have the DNA Center REST API active, using a super admin role user, and running version 1.2.10.4. However, I still get unauthorized.

The curl has no problem. 

It's either really wrong authentication or something wrong with your system

the following is always on Cisco Devnet sandbox DNA-C

 

curl -k -u devnetuser:Cisco123! -X POST https://sandboxdnac.cisco.com/dna/system/api/v1/auth/token

As an update. Recently updated to DNAC 1.2.12. The curl command with a base64 authz string still returns unauthorized. However, from within DNAC I can run the test code with the same input and DNAC returns a token. Still working with TAC on the issue to get a token remotely.

Could it be something else, not DNAC issue? 1.2.6 works for me and 1.3.0.2 works too.

Honestly, not sure. Connectivity is there. I cannot move to 1.3.0.2 as there is a major bug per BU:
We have found a critical bug in SDA fabric code on 1.3.0.3 which is getting fixed in 1.3.1. So, we recommend all our SDA production customers to hold off until 1.3.1 is out.
TAC is escalating the case internally. I will update once it is resolved. Thanks
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: