cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gbuhre
Helper III
Helper III

Post File via HTTP

I can't get this to work in flow. I get bad request. Below is the 400 status code and the header and body I'm sending. { "code": "InvalidObject", "message": "request object is invalid", "errors": [ { "code": "MissingRequiredField", "message": "The RecordId field is required.", "resource": "request", "field": "RecordId" }, { "code": "MissingRequiredField", "message": "The RecordType field is required.", "resource": "request", "field": "RecordType" }, { "code": "MissingRequiredField", "message": "The Title field is required.", "resource": "request", "field": "Title" }, { "code": "MissingRequiredField", "message": "File or Url is required.", "resource": "request", "field": "File" } ] } POST /v4_6_release/apis/3.0/system/documents HTTP/1.1 Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="recordid" 81014 ------WebKitFormBoundary7MA4YWxkTrZu0gW-- Content-Disposition: form-data; name="recordType" Opportunity ------WebKitFormBoundary7MA4YWxkTrZu0gW-- Content-Disposition: form-data; name="title" Test document ------WebKitFormBoundary7MA4YWxkTrZu0gW-- Content-Disposition: form-data; name="url" https:/********************/sites/*************s/************es/SI-160829.pdf ------WebKitFormBoundary7MA4YWxkTrZu0gW--

29 REPLIES 29

Just a hint: When you follow the OpenAPI 2.0 spec then you should be successful. 

Prof_E
New Member

@gbuhre 

@juresti 

 

are you still struggling with this? Please look at this work by @WillPage  and @SamPo 

 

https://powerusers.microsoft.com/t5/Building-Flows/HTTP-Post-multipart-form-data/m-p/332170/highligh...

 

Cheers

juresti
Continued Contributor
Continued Contributor

@Prof_E 

 

I no longer attempted to post via http. I could not post via the custom connector either.
FTP was the solution I ended up using to copy files into a remote server.

Anonymous
Not applicable

Dear Sven, I tried to figure out how to make it work with lexoffice, but get the follwing message:

 

Ihr Flow wurde gespeichert, konnte aber nicht aktiviert werden, weil er Connectors für Anwendungen enthält, die nicht mit dem in diesem Flow verwendeten Gmail-Connector kompatibel sind. Weitere Informationen

 

Any idea what to do? Which trigger / Connector do you use? GMail is apparently a problem.

 

Can you help me? 

Thanks!

Manuel

thank you!

i has sent file to end point successfully

f1se4
Regular Visitor

Hi gurus,

 

I have been following this post to get multi-part file working, using in this case azure python function, which has been tested using postman in local and cloud and is working fine.

 

Postman http code snippet

POST /api/xxxxxxxx HTTP/1.1
Host: xxxxxxxxxxxx.azurewebsites.net
Content-Length: 218
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="OnlyComercial.htm"
Content-Type: text/html

(data)
----WebKitFormBoundary7MA4YWxkTrZu0gW

 

And the suggested request from power automate.

 

f1se4_0-1667893064538.png

and the full flow

f1se4_1-1667893313072.png

When trying to execute http the flow is failing, is strange because in other tests (without making multi part working, the http was able to call azure function, but I haven't an http error at starting point)

 

f1se4_2-1667893498518.png

 

The input looks like:

 

f1se4_3-1667893628160.png

content....

f1se4_4-1667893667934.png

 

Someone, colud help me? I'm doing http request fine?

 

Thanks in advance!!!

 

Sergi

 

f1se4
Regular Visitor

Solved!!!

Inside json body

$content-type and $content doesn't need "$" and it was impacting over the http request. 

 

Now is working like a charm!!!! 😁

 

I have a badRequest when I use your body:

matthew11111112_0-1669304984376.png

 

Hi Matt,

 

What I sent to the azure function is the content of the file.

 

flow.png

Review if this is the case!!

 

:

Thank you!

Sergi García

 

@f1se4 

Error.

matthew11111112_0-1669309013325.png

 

 

In my case, I have to put X-NomFichier, it is why it is in my header. So how can I deal with that?

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,923)