cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

Choose one of the topics below for Cisco DNA Center Resources to help you on your journey with Cisco DNA Center

This community is for technical, feature, configuration and deployment questions.
For production deployment issues, please contact the TAC!
We will not comment or assist with your TAC case in these forums.

309
Views
0
Helpful
8
Replies
Rising star

Utilizing DNAC Intent APIs

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
Cisco Employee

Re: Utilizing DNAC Intent APIs

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

Rising star

Re: Utilizing DNAC Intent APIs

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.
Cisco Employee

Re: Utilizing DNAC Intent APIs

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

 

It works

Rising star

Re: Utilizing DNAC Intent APIs

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.
Highlighted
Cisco Employee

Re: Utilizing DNAC Intent APIs

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

Rising star

Re: Utilizing DNAC Intent APIs

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.
Cisco Employee

Re: Utilizing DNAC Intent APIs

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

Rising star

Re: Utilizing DNAC Intent APIs

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
CreatePlease to create content
Content for Community-Ad
July's Community Spotlight Awards