Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grafana overwrite existing dashboard via API

I'm trying to overwrite existing grafana dashboard via API, like this :

curl -X POST -H "Content-Type: application/json" "https://api_key:xxx/api/dashboards/db" -d @test.json

And i'm facing an issue with versioning, cannot overwrite the same dashboard with my json :

{"message":"The dashboard has been changed by someone else","status":"version-mismatch"}⏎

Is there a way to avoid this and force overwriting ?

Thanks !

like image 200
user2462699 Avatar asked May 26 '20 15:05

user2462699


1 Answers

That really depends what is in your test.json file. I expect correct dashboard model, so you just need to add a few fields to the top level, e.g.:

"overwrite": true,
"message": "my saved message, which will be available in the version history"

See API doc - https://grafana.com/docs/grafana/latest/http_api/dashboard/#create-update-dashboard

like image 194
Jan Garaj Avatar answered Oct 05 '22 04:10

Jan Garaj