I would like to use a HTTP method to post new dashboards to my local Kibana instance, but I couldn't find much documentation on using an API to do this.
There was a pull request on Kibana that mentioned it was adding this functionality, but there was limited documentation on how to use it: https://github.com/elastic/kibana/pull/10858
An example of a dashboard I'm trying to post:
{
"_id": "12345678-1234-1234-1234-1234567890op",
"_type": "dashboard",
"_source": {
"title": "my-app",
"hits": 0,
"description": "",
"panelsJSON": "",
"optionsJSON": "{\"darkTheme\":false}",
"uiStateJSON": "",
"version": 1,
"timeRestore": true,
"timeTo": "now/d",
"timeFrom": "now/d",
"refreshInterval": {
"display": "1 minute",
"pause": false,
"section": 2,
"value": 60000
},
"kibanaSavedObjectMeta": {
"searchSourceJSON": ""
}
}
}
Export:
curl "localhost:5601/api/kibana/dashboards/export?dashboard=980381a0-a266-11e7-8f86-edd4a877426e" > export.json
{
"version": "7.0.0-alpha1",
"objects": [
{
"id": "12345678-1234-1234-1234-1234567890op",
"type": "dashboard",
"properties": {
"title": "my-app",
"hits": 0,
"description": "",
"panelsJSON": "",
"optionsJSON": "{\"darkTheme\":false}",
"uiStateJSON": "",
"version": 1,
"timeRestore": true,
"timeTo": "now/d",
"timeFrom": "now/d",
"refreshInterval": {
"display": "1 minute",
"pause": false,
"section": 2,
"value": 60000
}
}
}
]
}
Import:
POST the response from the dashboard export API.
curl -X POST -H "Content-Type: application/json" -H "kbn-xsrf: true" -d @export.json http://localhost:5601/api/kibana/dashboards/import