Hi,
I'm trying to write a powershell script to import some saved objects I have created and exported from Kibana.
I can get this to work just fine on linux using curl: curl -X POST "http://myserver:5601/api/saved_objects/_import?createNewCopies=false" -H "kbn-xsrf: true" --form file=@MyDashboard.ndjson -H 'kbn-xsrf: true'
How do you do this with invoke-restmethod in powershell? The main thing I'm not seeing is something equivalent to "--form" and then defining the file=
Has anyone done this in PowerShell with Invoke-RestMethod? Can you provide an example?
I have used a similar method for a bulk insert
Invoke-WebRequest -uri "http://localhost:9200/_bulk" -Method POST -ContentType "application/json" -InFile C:\temp\test.json -UseBasicParsing
Thanks for the reply and the links but it seems that the Kibana API works a little differently requiring some extra headers or something. I've tried two methods and got to the point with both where I'm getting the error: "The remote server returned an error: (403) Forbidden."
I know I'm using the correct credentials as I can login through the web browser just fine.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.