Importing Kibana JSON files using API Call

I have JSON file which has an Index and its corresponding Searches, Visualizations and Dashbords.

Now I want to import that JSON file in to the kibana using the Import API call. I used the following api call to import a JSON file named X.
curl -u elastic:changeme -k -XPOST -H 'Content-Type: application/json' 'http://localhost:5601/api/kibana/dashboards/import' -H "kbn-xsrf: true" -d @Cloudtrail.json

It is showing following error:
{"statusCode":400,"error":"Bad Request","message":"\"value\" must be an object","validation":{"source":"payload","keys":["value"]}}

So what to do now? How to reslove this error?

Hey, it's possible there's a bug - context and few questions:

There's two ways to import/export via Kibana. The dashboard import api, which only accepts the format outputted from the dashboard export API. And then import/export from the settings page.

The import/export from the settings page isn't compatible with the dashboard api, and does some modifications in the browser before pushing the data to elasticsearch.

Does importing from the UI work? Can you share your before and after kibana versions? If no luck with either of these do you have a snippet of the json file we can look through?

Ok. Thanks for the clarification.
But can you provide us the APIs to export and Import dashbords...it will be helpful for us. Actually I already raised the ticket for on the same issue but none responded then...
here is the link for that discussion:
[https://discuss.elastic.co/t/importing-kibana-json-files-using-kibana-api-call/155344?u=shriharsha]

As far as the json file we were using was exported using the settings page...and importing is working fine from UI.

My only question is hot to import and export using APIs.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.