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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Using the HTTP (Premiu...
Power Automate
Answered

Using the HTTP (Premium) Connector inside Microsoft Flows, how do I POST (send) a file from SharePoint Library to external REST API?

(0) ShareShare
ReportReport
Posted on by 12

Using Microsoft Flows, I need to send over (transfer/upload) the FILES from the SharePoint Library to the outside/external Server via REST API. I suppose I need to use the "HTTP" (Premium) connector for this.

 

But how do I make use of this "HTTP" connector to POST (send) files? I know it is part of how HTTP POST works. But I still cannot figure out how to attach files inside the Microsoft Flow's "HTTP" connector.

 

Can someone please help me on this? Thanks much.

 

Screenshot 2022-07-28 at 12.22.50 PM.png

Categories:
I have the same question (0)
  • eric-cheng Profile Picture
    5,171 on at

    Hi @anonymust ,

     

    Depending on the API, you may need to send the file as a base64 string. 

     

    The API you are calling will have a schema or a swagger/open api definition which tells you what inputs are required to be passed in.  Do you have the details for this?  

     

    The below is how you would get a file from a document library and then convert it to base64 using an expression.  However, as mentioned, you still need to format the request body.

     

    ericcheng_0-1659002063555.png

     

    --------------------------------------------------------------------------
    If I have answered your question, please mark my post as a solution
    If you have found my response helpful, please give it a thumbs up

    Connect on LinkedIn

     

     

     

  • anonymust Profile Picture
    12 on at

    Hi @eric-cheng thanks much for helping.

     

    REST API is actually on our own servers with the simple PHP API codes which takes file attached as in "multipart/form-data".

     

    I could submit the HTTP POST requests using simple CURL command, like:

     

    curl -i -u username:password -X POST -H "Content-Type: multipart/form-data" -F "file=@sample.png" https://api.ourserver.com/upload/

     

    (I can make the exact same HTTP POST request with "multipart/form-data" using the Postman as well.)

     

    And then I could simply receive those attached files from our PHP REST API Servers, using something like:

     

    move_uploaded_file( $_FILES['file']['tmp_name'], '/usr/uploads/'.$_FILES['file']['name'] );

     

    All those files got saved on our Servers.

     

    But then from inside "HTTP" connector in Microsoft Flow, I don't know how to submit POST requests with "multipart/form-data" (or) to mimic such simple CURL command. I know how to put correct Headers there. But I'm confused on how to craft it's "Body" part into "multipart/form-data" equivalent.

     

    Hope you can advise on this. Thank you.

  • Verified answer
    eric-cheng Profile Picture
    5,171 on at

    Hi @anonymust ,

     

    Please check out the below two links which should get you on the right track on how to format your request body for the multipart/form-data content type.

     

    Using Multipart/Form-Data in a Power Automate or Logic Apps HTTP Action – Clavin's Blog (wordpress.com)

     

    Using the HTTP Action to POST Multipart Form Data in Power Automate & Logic Apps – William's IT Blog (willpage.dev)

     

    --------------------------------------------------------------------------
    If I have answered your question, please mark my post as a solution
    If you have found my response helpful, please give it a thumbs up

    Connect on LinkedIn

     

     

     

     

     

     

     

     

     

  • anonymust Profile Picture
    12 on at

    Hi @eric-cheng 

     

    I followed your first link and it worked! That was amazing!

     

    Thank you so much for your kind helps!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 594

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 281 Super User 2026 Season 1

Last 30 days Overall leaderboard