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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / HTTP request body not ...
Power Automate
Unanswered

HTTP request body not working

(0) ShareShare
ReportReport
Posted on by 435

Hello,

 

I am trying to send an HTTP request of a file to a custom API. (Which works) but the contents of the file, in this case a PDF, becomes everything I put in the body. (including the braces)

 

FoDelement_1-1607640022874.png

"{
“body”: { %PDF-1.3 %..."

Any idea what I am doing wrong? 

Maybe @Anonymous? 🙂

Categories:
I have the same question (0)
  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi @FoDelement 

     

    Can you try passing the file content directly without any braces or keys and see if it is working that way?

     

     

    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

  • FoDelement Profile Picture
    435 on at

    Hello!

    When I try that, the file becomes corrupted.  😞

    FoDelement_0-1607705432955.png

     

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    @FoDelement 

     

    Have you tried achieving this with Postman (to send the file)? 

     

    Can you try:

     

    {

    "body": filecontent

    }

     

    and get rid of the extra pair of {}

     

    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

  • FoDelement Profile Picture
    435 on at

    @yashag2255 

    I have gotten it to work with Postman as a Binary file, as well as form-data. I also have no issue using C# to get the file attached. 

    When I tried what you said, this happens.

    The brackets and "body" make their way into the file.

     

     

    FoDelement_0-1607707625744.png

     

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi @FoDelement 

     

    Would it be possible for you to share a screenshot from the Postman configuration? Regarding the headers and the body you are passing there? 

     

    I believe you can then pass the binary directly by accessing the "$content" key from the outputs of the file content of the get file content action. 

     

    If you could share the postman screenshot it would be easier to provide a better resolution for this. 

     

    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

  • FoDelement Profile Picture
    435 on at

    @yashag2255  I have spent two weeks trying to make this work. I am more than happy to share anything to make this work 🙂

    I just sent a new request as form-data. The pdf uploaded just fine. The only header I need is the Content-Disposition and it needs to have the value of "attachment; filename=XXXXX" otherwise the API rejects it saying it does not have a file name. 

    FoDelement_0-1607708744433.png

     

     

    FoDelement_1-1607708790598.png

     

    FoDelement_2-1607708812221.png

     



  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi @FoDelement 

     

    Try this: 

    yashag2255_0-1607712623568.png

     

    From : https://powerusers.microsoft.com/t5/Building-Flows/HTTP-Post-multipart-form-data/td-p/145181

     

    You already have the authentication from the HTTP Azure AD so just put everything in the body as in the screenshot and it should work. 

     

    Hope this helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

  • FoDelement Profile Picture
    435 on at

    @yashag2255 

    Hello again! I tried what you said, (see below)

    FoDelement_0-1607713227080.png


    but the content of the PDF that is created contains the whole body of the request.

    FoDelement_1-1607713286187.png

     

    Which results in the PDF appearing to be corrupted. 

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Since you are already passing the header in the body, can you remove it from the headers option on the action and try once?

     

    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS! 

  • FoDelement Profile Picture
    435 on at

    @yashag2255  

    When I remove the headers, and only use them in the body I run into the issue where it requires that the Content-Disposition header has the required value of "attachment; filename=XXXXX" but it does not work. It's possible I am putting it in the wrong spot maybe? 

     

     

    FoDelement_0-1607714608751.png

    FoDelement_1-1607714623801.png

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard