0
votes

I would like to get the query used in each of my dashboards using the Grafana API.

The expr field in the JSON model menu of the UI seems to contain the query. Is there a way of querying this using the API?

1
How many dashboards do you have? If not many then why not just copy / paste them?badaboomskey
I have around 15. I need to programmatically retrieve the querys for tests I am creating. The number of dashboards will inevitably increase over time.Perfect_Comment

1 Answers

2
votes

You can't do that. There is no official API which will return all "dashboard queries". It isn't possible, because frontend in the browser generate that and exact query depends on the user input (e.g. time range, dashboard variables, used macros, ....) and also used datasource.