Problem Posting to Kibana Shared Objects API

Hello there - I'm trying to use the Saved Objects "import" feature, but I keep getting 415 response codes. I used the export feature to export a dashboard to a ndjson file and then I try to push that same dashboard back to the cluster but it fails. I have tried with + without the headers "Content-Type": "application/ndjson" [or] "application/x-ndjson" but those don't seem to help.

Following the documentation here, I tried to run the first post and can't even get that to work. It should be noted that in the provided example, the only header set is -H "kbn-xsrf: true", nothing about application-type.

Does anyone have an idea of how to fix this 415 issue?

Hello,

So this import command worked for me:

curl -X POST "localhost:5601/api/saved_objects/_import?createNewCopies=true" -H "kbn-xsrf: true" --form file=@dashboard.ndjson -H 'kbn-xsrf: true'

dashboard.ndjson is the .ndjson file I am trying to import.

Thanks,
Bhavya

Please note there is a bug on the docs where copying as curl command is not working - [doc] Curl command is not exported correctly from Saved Objects API · Issue #76774 · elastic/kibana · GitHub

Thanks
Bhavya

Thank you for replying. That still didn't work for me, so I just decided to use the Dashboard API instead.

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