Export a dashboard via API
Get the dashboard JSON from the Grafana HTTP API
curl -s http://admin:admin@localhost:3000/api/dashboards/uid/MY_UID | jq .dashboard
- tool
- grafana11 commands
More grafana commands
-
curl -X POST -H "Content-Type: application/json" -d @dashboard.json http://admin:admin@localhost:3000/api/dashboards/importUpload a dashboard JSON through the Grafana HTTP API
-
curl -s http://admin:admin@localhost:3000/api/datasources | jq .[].nameList the names of all configured data sources
-
curl -X POST -H "Content-Type: application/json" -d @ds.json http://admin:admin@localhost:3000/api/datasourcesAdd a new data source through the Grafana API
-
# Place YAML in /etc/grafana/provisioning/dashboards/Grafana auto-loads dashboards from provisioning directory on startup
-
cat > /etc/grafana/provisioning/dashboards/default.yaml <<EOF apiVersion: 1 providers: - name: default type: file folder: '' options: path: /var/lib/grafana/dashboards EOFCreate a provisioning config for Grafana dashboards, then restart Grafana