I am looking for an API endpoint that would return the json data of a panel, if I provide the dasboard ID and panel ID. I sifted through the documentation, but couldn’t find anything that could help in this case.
welcome to the community @larissap!
This doesn’t parse out only the panel json, but you can get the dashboard json by the dashboard uid. The response includes panel json within it.
For example, if my dashboard uid is 1xBaknV7z
You can use the endpoint to get the dashboard json.
Hint: you can pipe the output to json_pp to pretty print it
For all of the API request options see:
Hello @melori.arellano !
Thank you for your reply, but I’m not sure this is what I’m looking for. I was looking for the panel data of a dashboard, like the image below. Is there any api to get this data, either in csv or json form?
@larissap, I misunderstood! I see you were asking if can you export the query result as a CSV with the API. There’s not an endpoint to do that. You could extract the query from the panel JSON and run it independently against the datasource.
The reporting feature (enterprise license required) allows you to send a scheduled report with a CSV attached. I’m not sure if you have a license or if that would work for use case, but wanted to mention it in case you do.
Hello @mellori.arellano, I’m using Prometheus as my datasource. So I should be able to get the csv from there, right? Is there an api that I can use to extract the query to get the panel json?
@larissap the dashboard API response contains the panel configurations for that dashboard, you could get the query there and then query Prometheus directly.
I haven’t tried this, but it looks like Robust Perception has a utility to convert query results to csv: