How to send a file to API through File manager widget

0
Hi Team, I have added the widget File Manager to data view successfully and now I want to send the selected file to some xyz API. How can I do that ?  
asked
2 answers
2

Hi Shreya,

 

You can use a button to call a microflow, and pass the uploaded file to that microflow inside you can call post service and pass the file based on the api.

Thanks

answered
1

lets say, your api has this signature: sendFileToApi(file: FileDocument)

 

  1. In the sendFileToApi microflow, use the HttpRequest and HttpResponse modules to send the file to the API. –

  2. You can use the HttpRequest.setBodyContentFromBinary method to set the body of the request to the contents of the file, and then use the HttpRequest.send method to send the request to the API.

  3.  

  4. Handle the response from the API in the sendFileToApi microflow, and use the Commit action to save any changes to the database if necessary.

answered