10-25-2021 07:43 AM
Hello,
i am trying to connect to the DNA Sandbox with following script:
import http.client conn = http.client.HTTPSConnection("sandboxdnac.cisco.com") headers = { 'content-type': "application/json", 'authorization': "<Authorization>" } conn.request("POST", "/dna/system/api/v1/auth/token", headers=headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))
Running this results in "Http Error Code 500" - an internal server side error.
Is there a way to resolve this issue?
Thank you!
10-25-2021 08:12 AM
Hello @cano707,
I've found 2 discussions on these boards related to your issue:
I would also check your hard-coded values for variables and clear your browser cache.
10-25-2021 08:46 AM
Thank you very much for your answer! Unfortunately, no solution was mentioned to my problem.
Because i was in hurry, i forgot to mention something important.
First:
I copied the script from the API Documentation on the Sandbox Page
Second:
I am able to run the API calls from within the API Documentation Page (Tools > Developer Toolkit).
Pressing "Try It" gives me the result i would expect.
I just don't understand why the queries from my local computer are not working.
10-25-2021 11:04 AM
Alright, i don't know if this is intended but i somehow found a workaround.
In case that you are not able to get the 'token' via Python, you have to get ON the page
of the Sandbox API.
Follow these steps:
After all that you will get a token, which you must store somewhere in your script.
Then you can use this token to make further API Calls.
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