I'm trying to create grafana dashboards from a template with the api from grafana. I use grafana v2.0.2 at the moment.
I have an api key and I'm able to get the dashboards with curl, but I'm unable to create dashboards.
When I do the following request: curl -i -H "Authorization: Bearer eyJrIobfuscatedlkIjoxfQ==" http://localhost:3000/api/dashboards/db/webserver2
then I get the json back for the dasboard.
When I try to create the simplest dashboard I found in the api examples it does not work: curl -i -H "Authorization: Bearer eyJrIobfuscatedlkIjoxfQ==" -d /tmp/simpledash http://localhost:3000/api/dashboards/db
where /tmp/simpledash
contains:
{
"dashboard": {
"id": null,
"title": "Production Overview",
"tags": [ "templated" ],
"timezone": "browser",
"rows": [
{
}
]
"schemaVersion": 6,
"version": 0
},
"overwrite": false
}
I get the following response:
HTTP/1.1 422 status code 422
Content-Type: application/json; charset=utf-8
Date: Wed, 01 Jul 2015 16:16:48 GMT
Content-Length: 84
[{"fieldNames": ["Dashboard"],"classification":"RequiredError","message":"Required"}]
I tried some variations of the json, but I always get that response and on the internet I could not find a working example. Anyone have a working example for me? I like to have this working so I can create dashboard from ansible.
Thanks!
[{}]
inside it, sending[]
on its own seems to have corrected this. It seems the JS sees the object and attempts to extract values from it. – Rebs