10-16-2020 05:58 AM
Hi,
I have trying many times to add the DNAC as environment with Postman tool but can't authenticate with the DNAC, even i have wrote right username and password, is it anyone had this issue before.
10-16-2020 07:23 AM
Here is an example:
10-17-2020 03:48 AM
choose the type of authentication as {Basic-Auth} also disable the ssl certificate verification
Please read my previous article will help you a little
10-19-2020 06:09 AM - edited 10-19-2020 06:10 AM
If using an off box python script this function can aide in getting the auth token. Just call it when needed:
def get_token():
API_URL = 'https://<dnac node>/api/system/v1/identitymgmt/token'
AUTH = '<user>','<pass>'
HEADER = {'content-type': 'application/json'}
r = requests.post(url=API_URL, auth=AUTH, headers=HEADER, verify=False)
data = r.text
key = json.loads(data)
token = key['Token']
print "DNAC Auth Token"
print token
return token
Then in other functions to call get_token you can do something like this:
..snippet..
data = get_token()
API_URL = 'https://<dnac node>/dna/intent/api/v1/network-device/'
AUTH = {
'X-Auth-Token' : data,
'Content-type' : 'application/json'
}
HTH!
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