-
What Grafana version and what operating system are you using?
Windows, Grafana 7.5.11 -
What are you trying to achieve?
I am trying to get data from API calls (any API call right now for testing, but my goal is to try to find all of the teams that a user viewing a dashboard belongs to). I am trying to initially just test out the APIs before incorporating them into my application (Angular/.NET app). -
How are you trying to achieve it?
I’ve been trying to call the APIs via curl, Insomnia (like Postman), and via Python script. I created an api key, set it as admin, and used this key in my api calls (shown below). -
What happened?
I receive a 401 unauthorized message. Specifically:
This server could not verify that you
are authorized to access the document
requested. Either you supplied the wrong
credentials (e.g., bad password), or your
browser doesn’t understand how to supply
the credentials required.
-
What did you expect to happen?
I am expecting a successful response based on what Grafana documentation outlines and based on my research that others have used the same code/commands to get this working. -
Can you copy/paste the configuration(s) that you are having problems with?
Here are my code excerpts:
curl:
curl -k -H "Authorization: Bearer <apikey>" https://<grafanaurl>/api/dashboards/home
python:
import json
import requests
server= "https:<grafanaurl>"
url = server + "/api/dashboards/home"
headers = {
"Authorization": "Bearer <apikey>",
"Accept": "application/json",
"Content-Type": "application/json"
}
r = requests.request("GET", url, headers=headers, verify=False)
print(r)
# print(r.json())
- Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
Nothing in the logs or on the UI
- Did you follow any online instructions? If so, what is the URL?
I followed the Grafana documentation for calling APIs, specifically the basic one to get the home dashboard: Dashboard HTTP API | Grafana documentation
I do see that we have basic auth enabled, but we also use LDAP authentication (so when a Grafana user opens the dashboard they do not need to sign in, it takes our organizations credentials). Does that have something to do with why this doesn’t work? I’ve tried adding my AD credentials into the api call when using Insomnia but that didn’t work either.