2019-10-16 22:10:40 +02:00
[[dashboard-import-api]]
2019-09-06 18:09:57 +02:00
=== Import dashboard API
++++
<titleabbrev>Import dashboard</titleabbrev>
++++
2018-09-07 21:52:08 +02:00
2019-09-18 17:54:28 +02:00
experimental[] Import dashboards and corresponding saved objects.
2018-12-05 22:20:58 +01:00
2019-09-06 18:09:57 +02:00
[[dashboard-api-import-request]]
2018-09-07 21:52:08 +02:00
==== Request
2020-03-20 22:33:20 +01:00
`POST <kibana host>:<port>/api/kibana/dashboards/import`
2018-09-07 21:52:08 +02:00
2020-10-21 09:20:54 +02:00
`POST <kibana host>:<port>/s/<space-id>/api/kibana/dashboards/import`
2019-09-06 18:09:57 +02:00
[[dashboard-api-import-params]]
==== Query parameters
2018-09-07 21:52:08 +02:00
2019-09-06 18:09:57 +02:00
`force`::
(Optional, boolean) Overwrite any existing objects on ID conflict.
2020-02-18 17:31:51 +01:00
2019-09-06 18:09:57 +02:00
`exclude`::
(Optional, array) Saved object types that you want to exclude from the import.
2018-09-07 21:52:08 +02:00
2019-09-06 18:09:57 +02:00
[[dashboard-api-import-request-body]]
==== Request body
2018-09-07 21:52:08 +02:00
2020-09-16 16:52:42 +02:00
Use the complete response body from the <<dashboard-api-export, Export dashboard API>> as the request body. Do not manually construct a payload to the endpoint. The max payload size is determined by the `savedObjects.maxImportPayloadBytes` configuration key.
2018-09-07 21:52:08 +02:00
2019-09-06 18:09:57 +02:00
[[dashboard-api-import-response-body]]
2018-09-07 21:52:08 +02:00
==== Response body
2020-02-18 17:31:51 +01:00
`objects`::
(array) A top level property that includes the saved objects.
2018-09-07 21:52:08 +02:00
2019-09-06 18:09:57 +02:00
[[dashboard-api-import-codes]]
==== Response code
2018-09-07 21:52:08 +02:00
2019-09-06 18:09:57 +02:00
`200`::
2020-02-18 17:31:51 +01:00
Indicates a successful call, even if there are errors importing individual saved objects. If there are errors, the error information is returned in the response body on an object-by-object basis.
2019-09-06 18:09:57 +02:00
[[dashboard-api-import-example]]
==== Example
2018-09-07 21:52:08 +02:00
2020-03-20 22:33:20 +01:00
[source,sh]
2018-09-07 21:52:08 +02:00
--------------------------------------------------
2020-07-14 21:59:21 +02:00
$ curl -X POST api/kibana/dashboards/import?exclude=index-pattern
2018-09-07 21:52:08 +02:00
{
"objects": [
{
"id": "80b956f0-b2cd-11e8-ad8e-85441f0c2e5c",
"type": "visualization",
"updated_at": "2018-09-07T18:40:33.247Z",
"version": 1,
"attributes": {
"title": "Count Example",
"visState": "{\"title\":\"Count Example\",\"type\":\"metric\",\"params\":{\"addTooltip\":true,\"addLegend\":false,\"type\":\"metric\",\"metric\":{\"percentageMode\":false,\"useRanges\":false,\"colorSchema\":\"Green to Red\",\"metricColorMode\":\"None\",\"colorsRange\":[{\"from\":0,\"to\":10000}],\"labels\":{\"show\":true},\"invertColors\":false,\"style\":{\"bgFill\":\"#000\",\"bgColor\":false,\"labelColor\":false,\"subText\":\"\",\"fontSize\":60}}},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}}]}",
"uiStateJSON": "{}",
"description": "",
"version": 1,
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{\"index\":\"90943e30-9a47-11e8-b64d-95841ca0b247\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}"
}
}
},
{
"id": "90943e30-9a47-11e8-b64d-95841ca0b247",
"type": "index-pattern",
"updated_at": "2018-09-07T18:39:47.683Z",
"version": 1,
"attributes": {
"title": "kibana_sample_data_logs",
"timeFieldName": "timestamp",
"fields": "<truncated for example>",
"fieldFormatMap": "{\"hour_of_day\":{}}"
}
},
{
"id": "942dcef0-b2cd-11e8-ad8e-85441f0c2e5c",
"type": "dashboard",
"updated_at": "2018-09-07T18:41:05.887Z",
"version": 1,
"attributes": {
"title": "Example Dashboard",
"hits": 0,
"description": "",
"panelsJSON": "[{\"gridData\":{\"w\":24,\"h\":15,\"x\":0,\"y\":0,\"i\":\"1\"},\"version\":\"7.0.0-alpha1\",\"panelIndex\":\"1\",\"type\":\"visualization\",\"id\":\"80b956f0-b2cd-11e8-ad8e-85441f0c2e5c\",\"embeddableConfig\":{}}]",
2019-01-23 23:29:35 +01:00
"optionsJSON": "{\"useMargins\":true,\"hidePanelTitles\":false}",
2018-09-07 21:52:08 +02:00
"version": 1,
"timeRestore": false,
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}"
}
}
}
]
}
--------------------------------------------------
// KIBANA