-
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
Import / Export API for Dashboards #10858
Conversation
289ccd3
to
b68133a
Compare
Does the export request actually result in any changes internally? If not, why not just do a GET instead? |
No reason other then I was just trying to provide the maximum options so you could either use a GET or POST depending on which HTTP religion you subscribed to :D |
mark |
Hamill |
@xycloud If you just want to see updates for a given issue, please use the "subscribe" link on the right side of posts rather than leaving a generic comment |
@monicasarbu I added two query arguments to the import api:
|
There's no documentation for these endpoints yet as they are still experimental, but if you like to live on the bleeding edge, you can feel free to give them a whirl. We are using these APIs for beats dashboard setup in 6.0 onward, so they are probably going to remain pretty stable despite being experimental. In the absence of documentation, I recommend setting up a Kibana dashboard and then using the export API ( |
@epixa it is valid ... it's that response body I'm grabbing with the ansible above (from my dev instance) and then import directly to the test and prod instances. But you can't just /api/kibana/dashboards/export AFAIK ... you need the id of the dashboard you want to grab or it errors stating it's missing a dashboard.id |
@hogarthj Thanks for the clarification, and yes, you're correct. You must specify |
@epixa and @hogarthj Yes... the response from the export is the body for the import. You are required to provide
To import it looks like
If you are NOT using x-pack you can omit the |
The dashboard
|
@dkirrane, alternatively you can use the Saved Objects API to capture the ID's:
|
@tylersmalley tried that. Got the id but still returning 404. Tried with both Kibana 5.5.1 and 5.5.2
|
Use api in the url rather than app. |
This API is very handy, but there's something I'm not sure I understand: assuming that the only way to export a dashboard with the UI is to use Shouldn't the API be accompanied by a UI update which unifies the import/export processes, both from their API and UI perspectives? |
@cjauvin I suspect the two outputs will converge at some point, but they don't do the same thing at the moment, and we're not yet ready to say for sure whether they will converge or not. "Export everything" is a raw dump of certain types of saved objects, whereas this new import/export API is a more intelligent mechanism to export all related saved objects for a given dashboard. Out of curiosity, do you have a specific workflow in mind that would benefit from a shared format? |
@epixa Thanks for the quick answer! I do have a specific workflow in mind: we are currently provisioning an ES + Kibana stack running in a Kubernetes cluster, and in this context your API is very handy as a way to automatically provision required dashboards at the cluster creation and setup stage (with the Helm tool, specifically). However, we would like it also to be extra easy for a cluster operator to be able to contribute any dashboard update (say a title change) back into the setup scripts.. and for this simply exporting (from the UI) + copy/pasting would probably be the path of least friction. |
@epixa I've always envision doing an export from the dashboard listing page, click the checkboxes next to the dashboards you want to export and click the new export button that shows up next to the delete button. And it just redirects you the the API URL with the query arguments for the dashboards. BTW... the export response already has the content-disposition header for treating it as a download. So really all that is left is the UI work. :D |
@simianhacker That experience sounds great to me. We can't just jump into it since import needs to accommodate existing json exports, but it sounds like a good goal |
Great API, really useful for our project, I have no problems with exporting. Do we have any examples of the request body for an import POST? |
@yangwong9664 it’s the same as the response from the export. |
@simianhacker Thanks. |
Is there a way to simply dump all objects through this API? I see the import takes a list of objects. |
ah i see #11632 |
This PR creates an import / export API for dashboards. The current implementation under
Mangement > Saved Objects
allows you to only exporteverything
or individual dashboards (with out the supporting saved objects like searches, visualizations or index patterns). This creates 2 API endpoints at/api/kibana/dashboards/export
and/api/kibana/dashboards/import
. The user can POST to the export end point an array of dashboard IDs. The response will contain ALL (searches, index patterns, visualizations, etc) the objects needed for that dashboard in an object with a version. To import a dashboard (an all of it's supporting objects) the user can POST the same object returned from the export endpoint to the import endpoint. The import endpoint will check the version and try and upgrade the objects if they are from a previous version; and import them into the.kibana
index; skipping existing objects.