How to upload file in Kibana Plugin development?

I'm Developing a Kibana Plugin where there is a need to take txt or xlsx files as input from users and process them at backend.

I have generated the sample plugin using kibana plugin generator, in that I'm using euifilepicker component at front end but whenever I send a post request via httpclient in there is a 400 bad request response.

I've tried setting

but whenever I pass the files returned from the euifilepicker, and hit the url there is 400 bad request.

please help, simple example will be very helpful.

thanks and regards

Hi K_Chaitanya

Have you tried to access your server route API in a REST client (like Postman) to see what error is returned?

The url might look something like: http://localhost:5601/<random>/api/<your-plugin>/<route>

This would help in understanding what the problem might be.



this was the response when i hit it with postman

Can you go to the "Headers" tab and add kbn-xsrf in the Key and xxx for the Value and then launch the request again?

1 Like

It worked, thanks. I'm able to hit the url in post method with formdata.

if there are any notes regarding kbn-xsrf and why this error was thrown, please share.

This is only needed when developing and accesing the Kibana server api from outside the web application

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