Hi,
I just started working with postman and wanted to see if I could get some help with constructing the POST request body.
My sample request body (JSON) is
{
“id”: “correlation_id”
“data”: “HTML_STRING”
}
As I understand we’d need to escape the special characters in HTML_STRING. What would be the best way to achieve loading the html content from file and having it as a part of the request as shown above, in Postman? Do I need to get the escaped content with some external script/online tool first before I formulate the request and then POST to my API ?
If you are writing an external script for creating a file, I would suggest escaping the special characters and then putting the HTML content in the file.
you can use postman’s pre-request script for escaping the special characters in HTML content.
Here the data, unless is escaped in the json/csv, does not seem valid. Doesn’t that necessitate that extra step to escape the data content first? Also, another example of the content I might send, on a different endpoint, is an email (headers with plain/html content), so not exactly just HTML. My apologies, if that would change the context and content of your original answer. I thought they could be handled in the same fashion.