I am using a custom connector to send API requests to a server. I am using an attachment box in Powerapps as a "file upload". I pass the file to flow using Shane's method here. The file uploads (in this case a PDF) but when I try to open it, it is corrupted. I can not figure out how to post the file correctly. Here is an example of it working in Postman. (using form-data)
I assume I need to define both the content type and the content? But I am not sure how to do that.
Hi @FoDelement ,
At the right side of the Postman below Send button there is a link to view code (Code) , you can click on it to view the request which is sent. In the pop up window that opens(Generate Code Snippets) select HTTP from the list of options at left side. The JS code you see can be used in custom connector testing as well. Not sure if the testing allows to attach file but you can run the test case in Flow.
Thank you for this info. Below is the output. I cans see where it is getting the file name from, but it does not show how it's passing the actual data. I was hoping putting the base64 data as the body in the custom connector would work, but so far I can't get the files to open.
POST /SM/9/rest/interactions/SD5443824/attachments HTTP/1.1
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: attachment; filename=2020-10-02 16_06_00-Start.pdf
Authorization: Basic XXX=
Content-Disposition: form-data; name="file"; filename="/C:/Users/XXXXXX/Downloads/14016_RolloverForm.pdf"
Hi @FoDelement ,
Unfortunately I do not have answer for attaching the file for testing in Custom Connector. But what you can do is place a file in Sharepoint and do get file content of Sharepoint action and in the next step use HTTP request POST call with above information. Add only Content Type ,Authorization and File name in Header and in Body use content of previous action.
Sadly our server requires VPN, so that is why we use a custom connector (For the data gateway).
Thank you for the tips. I will keep trying. 😁