web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : Ky6SWtHKssld93W1EptZWs
Power Automate - Building Flows
Unanswered

HTTP How to Calculate Content-Length multipart/form-data Including Binary

Like (1) ShareShare
ReportReport
Posted on 20 Mar 2025 01:51:30 by
I'm working with a very obstinate API with arguably horrendous documentation (which is often also incorrect).  I'm fairly certain my Cloud Flow is failing to POST a request to it containing multipart/form-data because I'm not passing the Content-Length header, at least that's the only thing I can deduce comparing the trace output of a curl command that is able to make the request vs what I have in my HTTP action.
 
I've resorted to using the smallest jpg that I think is possible (107 bytes) to try to reduce the potential for error, however I still haven't found a way to accurately calculate what the Content-Length actually would be.
 
For context, the file is uploaded to a sharepoint site, and then needs to be sent to a third party API as binary.  So the reference to "Body" inside the body is actually the output from a Sharepoint Get File Contents action that happens before the API request.  Also the current Content-Length value is being set by a Compose step I've been using to try to calculate it.
 
Does anyone know how to calculate what the body would be including the binary that's in there?
 
 
BTW, this one is close, but I'm not sending it as Base64
Screenshot 2025-0...

Your file is currently under scan for potential threats. Please wait while we review it for any viruses or malicious content.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2