Let’s say I have a set of credentials for a Grafana user with Editor permissions on a given organization. I’m looking for a programmatic way to obtain basic details about that user’s default datasource - i.e. the default datasource for their current organization. By “basic details” I mean specifically the datasource ID and the database name - these are the two bits of information that I need to issue datasource queries for that datasource, at least for Influx.
I feel like this should be possible, since those details are already available to the user, for example when they create a new dashboard panel. Indeed, the datasource details are contained within the
window.grafanaBootData settings provided when http://grafanahost/dashboard/new is loaded.
So as a workaround I could load entire “new dashboard” page and parse the text to pull these details out, but ideally I’d like to do this via an API call. Yet, calling the data source API endpoint with Editor credentials simply returns 403. That partly makes sense, since some of the data provided by that endpoint (e.g. datasource credentials) should only be accessible to admin users, but it would be nice to also be able to get basic details as an Editor or Viewer.
Any ideas as to how I can do what I’m trying to do?