-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[skip ci] docs: dashboard import/export API #22835
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[[dashboard-import-api]] | ||
== Dashboard Import API | ||
|
||
The dashboard import/export APIs allow people to import dashboards along with | ||
all of their corresponding saved objects such as visualizations, saved | ||
searches, and index patterns. | ||
|
||
Traditionally, developers would perform this level of integration by writing | ||
documents directly to the `.kibana` index. *Do not do this!* Writing directly | ||
to the `.kibana` index is not safe and it _will_ result in corrupted data that | ||
permanently breaks Kibana in a future version. | ||
|
||
* <<dashboard-import-api-import>> | ||
* <<dashboard-import-api-export>> | ||
|
||
include::dashboard-import/import.asciidoc[] | ||
include::dashboard-import/export.asciidoc[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
[[dashboard-import-api-export]] | ||
=== Export Dashboard | ||
|
||
experimental[This functionality is *experimental* and may be changed or removed completely in a future release.] | ||
|
||
The dashboard export API allows people to export dashboards along with all of | ||
their corresponding saved objects such as visualizations, saved searches, and | ||
index patterns. | ||
|
||
==== Request | ||
|
||
`GET /api/kibana/dashboards/export` | ||
|
||
==== Query Parameters | ||
|
||
`dashboard` (optional):: | ||
(array|string) The id(s) of the dashboard(s) to export | ||
|
||
==== Response body | ||
|
||
The response body will have a top level `objects` property that contains an | ||
array of saved objects. The order of these objects is not guaranteed. You | ||
should use this exact response body as the request body for the corresponding | ||
<<dashboard-import-api-import, Import Dashboard API>>. | ||
|
||
==== Examples | ||
|
||
The following example exports all saved objects associated with and including | ||
the dashboard with id `942dcef0-b2cd-11e8-ad8e-85441f0c2e5c`. | ||
|
||
[source,js] | ||
-------------------------------------------------- | ||
GET api/kibana/dashboards/export?dashboard=942dcef0-b2cd-11e8-ad8e-85441f0c2e5c | ||
-------------------------------------------------- | ||
// KIBANA | ||
|
||
A successful call returns a response code of `200` along with the exported | ||
objects as the response body. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
[[dashboard-import-api-import]] | ||
=== Import Dashboard | ||
|
||
experimental[This functionality is *experimental* and may be changed or removed completely in a future release.] | ||
|
||
The dashboard import API allows people to import dashboards along with all of | ||
their corresponding saved objects such as visualizations, saved searches, and | ||
index patterns. | ||
|
||
==== Request | ||
|
||
`POST /api/kibana/dashboards/import` | ||
|
||
==== Query Parameters | ||
|
||
`force` (optional):: | ||
(boolean) Overwrite any existing objects on id conflict | ||
`exclude` (optional):: | ||
(array) Saved object types that should not be imported | ||
|
||
==== Request Body | ||
|
||
The request body is JSON, but you should not manually construct a payload to | ||
this endpoint. Instead, use the complete response body from the | ||
<<dashboard-import-api-export, Export Dashboard API>> as the request body to | ||
this import API. | ||
|
||
==== Response body | ||
|
||
The response body will have a top level `objects` property that contains an | ||
array of the saved objects that were created. The order of these objects is not | ||
guaranteed. | ||
|
||
==== Examples | ||
|
||
The following example imports saved objects associated with and including the | ||
dashboard with id `942dcef0-b2cd-11e8-ad8e-85441f0c2e5c`. | ||
|
||
[source,js] | ||
-------------------------------------------------- | ||
POST api/kibana/dashboards/import?exclude=index-pattern | ||
{ | ||
"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\":{}}]", | ||
"optionsJSON": "{\"darkTheme\":false,\"useMargins\":true,\"hidePanelTitles\":false}", | ||
"version": 1, | ||
"timeRestore": false, | ||
"kibanaSavedObjectMeta": { | ||
"searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
-------------------------------------------------- | ||
// KIBANA | ||
|
||
A successful call returns a response code of `200`. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This API returns 200 regardless if there are errors within the bulk operations or not. That indicates that the bulk operation itself was successful, but the user will still need to check the results for any errors that may occurred.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good catch.