我正在尝试通过API覆盖现有的grafana仪表板,例如:
curl -X POST -H "Content-Type: application/json" "https://api_key:xxx/api/dashboards/db" -d @test.json
我正面临版本控制问题,无法用json覆盖同一仪表板:
{"message":"The dashboard has been changed by someone else","status":"version-mismatch"}⏎
有没有办法避免这种情况并强制覆盖?
谢谢!
答案 0 :(得分:1)
这实际上取决于您的test.json
文件中的内容。我希望仪表板模型正确,因此您只需要在顶层添加一些字段即可,例如:
"overwrite": true,
"message": "my saved message, which will be available in the version history"
请参阅API文档-https://grafana.com/docs/grafana/latest/http_api/dashboard/#create-update-dashboard