How to pass HTML body in a HTTP request?

I am trying to POST some data using UiPath HTTP requests,
But my problem is whenever I pass any HTML data to the JSON body of HTTP request it says, invalid JSON. If I pass the string then it’s working fine. I have tested the API endpoint in Postman I am getting the correct result.

I have replaced all the " to ’ but the same error.

image

1 Like

Hi

Welcome back to UiPath community

If that’s the case may I know along which property your value is been passed and can I have a screen shot if possible pls

Cheers @MartianxSpace

I have fixed my issue.
The problem was that UiPath excepts HTML body like the below code.

"<div class=\“zd-comment" dir="auto">Hello Trisha,

I went to check Mike’s reporting role assignment and could no…”

There is a “\” after div class but I was providing the HTML body like

**

“<div class="zd-comment" dir="auto">Hello Trisha,

I went to check Mike’s reporting role assignment and could no…”

**

without any “\”.
So what I have done is I have removed all the Environment.Newline using Regex (Remove line breaks in string - #2 by PrankurJoshi) and added “\” in the HTML body by doing String.Replace(“”“”, “\”“”).

Note: The “\” was there before all the " so it was easier to ad ""

4 Likes