- What Grafana version and what operating system are you using?
10.0.1 on Rocky 9.6
- What are you trying to achieve?
Figure out best way to allow ‘round-trip’ dashboard maintenance via the API - create dashboards from json files stored in source control, edit them live, export the json in a format it can go back into the repo.
- How are you trying to achieve it?
I have had success mangling the output of either the dashboard GET call (api/dashboards/uid/) or exporting from the GUI (I believe its the API under the covers anyway, but the outputs are quite different) and then deleting and re-creating dashboards (api/dashboards/db). But there is quite a lot of faffing with json, removing the dashboard UID, potentially updating datasources etc. I then came across the following github discussion where torkelo suggests there is a Dashboard Import API which is designed to be used to allow import of GUI-export format files. He also suggests that required params (e.g. new local datasource in import destination etc.) can be added to the POST operation. However, he only supplies a tiny screenshot and does not link to the docs.
-
Questions in a nutshell:
- Can anyone point at documentation for Dashboard Import API? I cannot find it at any version level in the docs.
- Can anyone point at a detailed example of using it?
- Does anyone have a good overview of a way to carry out ‘round-trip’ dashboard creation via the API and/or GUI? (file-based provisioning does not fully meet our requirement because the dashboard json is too large to push into the configMap of some of our k8s installations)