Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

HTTP request - Double quotes inside the Body get replaced by escape and double quotes instead

Like (0) ShareShare
ReportReport
Posted on 14 Apr 2023 10:41:01 by 31

Good morning Community

 

I am building a flow that needs to send a CSV file to an endpoint, I have managed to built the request meeting all the requirements from the vendor, however, when the request is sent then fails. Looking at the raw data that gets sent to the API in the POST request, I noticed that every part of the body that contains double quotes, get replaced with /"value"/, and this is the cause of the failure. This API is very sensitive.

 

Is there any way I can change this so the double quotes are left intact?, please see below the screenshot of the flow and the raw data that gets generated:

 

acharry_0-1681467430068.png

 

The body I am sending is this:

--fileboundary
Content-Disposition: form-data; name="module"

InternalTest
--fileboundary
Content-Disposition: form-data; name="import_template_id";

XXXXX
--fileboundary
Content-Disposition: form-data; name="payload"; filename="API_data_Test.csv"

 

This is the body being sent to the API, I highlighted in red what needs to be kept in only double quotes:

"body":" --fileboundary\r\nContent-Disposition: form-data; name=\"module\"\r\n\r\nInternalTest\r\n--fileboundary\r\nContent-Disposition: form-data; name=\"import_template_id\";\r\n\r\nXXXXXXXX\r\n--fileboundary\r\nContent-Disposition: form-data; name=\"payload\"; filename=\"API_data_Test.csv\"\r\n\

 Is there any way I can keep the body as I am drafting it above?

  • Verified answer
    acharry Profile Picture
    31 on 02 Jun 2023 at 16:41:13
    Re: HTTP request - Double quotes inside the Body get replaced by escape and double quotes instead

    I have managed to fix my issue, after going in loops and chasing ghosts, here is the answer to this.

     

    Firstly, the quotes weren't an issue, the HTTP request is intelligent enough to understand the format and the scape is only how the UI displays it.

     

    For this to work, I had to change the body of the request, first, I created and initialized a variable of type JSON, inside it I entered the body of the HTTP request, and in there I specified the CSV file or content that I want to send in my POST request, which I think was causing the issue, so now it looks like this:

    acharry_0-1685723769195.png

     

    Then, I just used the variable above in my HTTP request as per screenshot below:

     

    acharry_1-1685723897533.png

    And after this, the workflow worked successfully doing the POST request as expected.

     

    In the end, things were much easier than I initially thought.

     

    Thanks,

     

    Angelica

     

  • acharry Profile Picture
    31 on 17 Apr 2023 at 10:02:55
    Re: HTTP request - Double quotes inside the Body get replaced by escape and double quotes instead

    Hi Ibendlin, thank you for your comment.

     

    What do you mean with IRL? I am not really sure what you mean or how to check it. I am looking at the Input data that I can see in the request which is the one I attached to this post.

     

    acharry_0-1681725564650.png

    "body":" --fileboundary\r\nContent-Disposition: form-data; name=\"module\"\r\n\r\nInternalTest\r\n--fileboundary\r\nContent-Disposition: form-data; name=\"import_template_id\";\r\n\r\nXXXXXXXX\r\n--fileboundary\r\nContent-Disposition: form-data; name=\"payload\"; filename=\"API_data_Test.csv\"\r\n\

    The server is giving me an Internal Server Error but nothing more. 

     

    Many thanks,

     

    Angelica

  • lbendlin Profile Picture
    7,799 Super User 2025 Season 1 on 17 Apr 2023 at 09:18:10
    Re: HTTP request - Double quotes inside the Body get replaced by escape and double quotes instead

    Do you have access to the endpoint's logs?  Wonder how the request comes through IRL. Maybe the escaping only happens in the Power Automate UI.

  • acharry Profile Picture
    31 on 17 Apr 2023 at 08:55:17
    Re: HTTP request - Double quotes inside the Body get replaced by escape and double quotes instead

    Thank you for your reply.

    My current problem isn't the CSV data but the Body structure. Power Automate takes all the values wrapped in double quotes and replace them with escape quotes when sending the request as shown above.

     

    It is a very sensitive endpoint and I have to send the data as I've shown in the screenshot, otherwise it rejects it.

  • lbendlin Profile Picture
    7,799 Super User 2025 Season 1 on 15 Apr 2023 at 23:44:26
    Re: HTTP request - Double quotes inside the Body get replaced by escape and double quotes instead

    I don't think you can send a CSV as form-data. Probably needs to be sent as binary, likely base64 encoded.

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,745 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,091 Most Valuable Professional

Leaderboard