Insert HTML in Collection Runner

Hello everyone!

I’m trying to create a collection runner with external data, with a field containing a HTML layout for e-mails. I had scaped all the double quotes in my data file, but Postman does not recognize.

Data:

[
{
“OWNER_TYPE_ID”: 2,
“OWNER_ID”: 909,
“TYPE_ID”: 4,
“COMMUNICATIONS”: [ { “VALUE":"email@email.com”}, { “VALUE":"email@email.com”} ],
“SUBJECT”: “Teste por API 10”,
“COMPLETED”: “Y”,
“PRIORITY”: 2,
“RESPONSIBLE_ID”: 45,
“DESCRIPTION”: “p{margin-top:0px; margin-bottom:0px;}</style><body class=“setupTab” style=” background-color:#FFFFFF; bEditID:b1st1; bLabel:body;"><table cellpadding=“0” width=“500” cellspacing=“0” id=“topTable” height=“450” ><tr valign=“top” ><td style=" background-color:#FFFFFF; bEditID:r1st1; bLabel:header; vertical-align:top; height:100; text-align:left;"><img border=“0” bEditID=“r1sp1” bLabel=“headerImage” id=“r1sp1” src=“serverurl” ></img></td></tr><tr valign=“top” ><td style=" background-color:#FFFFFF; bEditID:r2st1; bLabel:accent1; height:0;"></td></tr><tr valign=“top” ><td styleInsert=“1” height=“300” style=" background-color:#FFFFFF; color:#000000; bEditID:r3st1; bLabel:main; font-size:12pt; font-family:arial;"><table border=“0” cellpadding=“5” width=“550” cellspacing=“5” height=“400” ><tr valign=“top” height=“400” ><td tEditID=“c1r1” style=" background-color:#FFFFFF; color:#000000; bEditID:r3st1; bLabel:main; font-size:12pt; font-family:arial;" aEditID=“c1r1” locked=“0” ><table width=“800” border=“0”>

<p style=“font: small/normal Times New Roman; color: rgb(0, 65, 130); text-transform: none; text-indent: 0px; letter-spacing: normal; margin-top: 0px; margin-bottom: 0px; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;”><span style=“font-family: Arial, sans-serif; font-size: 10pt;”>Carolina,
Bom dia!</span></p><p style=“font: small/normal Times New Roman; color: rgb(0, 65, 130); text-transform: none; text-indent: 0px; letter-spacing: normal; margin-top: 0px; margin-bottom: 0px; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;”><span style=“font-family: Arial, sans-serif; font-size: 10pt;”>
\t\t\tConforme solicitado, segue proposta comercial para an\u00E1lise.</span></p><p style=“font: small/normal “Times New Roman”; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; margin-top: 0px; margin-bottom: 0px; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;”> </p><p style=“font: small/normal Times New Roman; color: rgb(0, 65, 130); text-transform: none; text-indent: 0px; letter-spacing: normal; margin-top: 0px; margin-bottom: 0px; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;”><span style=“font-family: Arial, sans-serif; font-size: 10pt;”>\t\t\tFicamos no aguardo do aceite.</span></p><p style=“font: small/normal “Times New Roman”; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; margin-top: 0px; margin-bottom: 0px; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;”> </p><p style=“font: small/normal Times New Roman; color: rgb(0, 65, 130); text-transform: none; text-indent: 0px; letter-spacing: normal; margin-top: 0px; margin-bottom: 0px; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;”><span style=“font-family: Arial, sans-serif; font-size: 10pt;”>\u00C0 \t\t\tdisposi\u00E7\u00E3o para esclarecimentos.

\t\t\tAtenciosamente,</span><span style=“font-family: Arial, sans-serif; font-size: 8pt;”>
\t\t\t </span></p><p style=“margin-top: 0px; margin-bottom: 0px;”> </p></td></tr> <p style=“font: 700 small/normal Times New Roman; color: rgb(0, 65, 130); text-transform: none; text-indent: 0px; letter-spacing: normal; margin-top: 0px; margin-bottom: 0px; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;”><span style=“font-family: Arial, sans-serif; font-size: 10pt;”>\t\t\tAnderson de Oliveira Dias</span></p><p style=“margin-top: 0px; margin-bottom: 0px;”><span style=“color: rgb(0, 65, 130); font-family: Arial; font-size: 10pt;”>\t\t\tHaztec Tecnologia e Planejamento Ambiental S.A.
\t\t\tRua Joaquim Palhares, 40 | 1\u00BA andar | Cidade Nova
\t\t\tRio de Janeiro | RJ | Cep 20260-080
\t\t\tTel.: <span class=“skype_c2c_print_container skype_c2c notranslate”>+55 (21) 3974-6158</span></span></p><p style=“margin-top: 0px; margin-bottom: 0px;”><span style=“color: rgb(91, 155, 213); font-size: 10pt;”><a style=“color: blue; text-underline: single;” href=“mailto:sac@haztec.com.br”><span style=“color: rgb(0, 65, 130); font-family: Arial; text-decoration: none;”>\t\t\tsac@haztec.com.br</span></a></span><span style=“font-size: 10pt;”><font color="#004182" face=“Arial”>
</font></span>\t\t\t <span style=“color: rgb(91, 155, 213); font-family: Arial; font-size: 10pt;”><a style=“color: blue; text-underline: single;” href=“http://www.haztec.com.br/”><span style=“color: rgb(0, 65, 130); text-decoration: none;”>\t\t\twww.haztec.com.br</span></a></span></p><p style=“margin-top: 0px; margin-bottom: 0px;”><font color="#004182"><img align=“left” alt="" src=“https://c.na11.content.force.com/servlet/servlet.ImageServer?id=015G000000CcNh2&oid=00DG0000000kj2I” border=“0”>
</font></p><p style=“margin-top: 0px; margin-bottom: 0px;”> </p><p style=“margin-top: 0px; margin-bottom: 0px;”><span style=“color: rgb(0, 65, 130); font-family: Arial,sans-serif; font-size: 7.5pt;”>  \t</span></strong></p><p style=“margin-top: 0px; margin-bottom: 0px;”><span style=“color: rgb(0, 65, 130); font-family: Arial,sans-serif; font-size: 7.5pt;”>
</span></strong></p><p style=“margin-top: 0px; margin-bottom: 0px;”><span style=“color: rgb(0, 65, 130); font-family: Arial,sans-serif; font-size: 7.5pt;”>
</span></strong></p><p style=“margin-top: 0px; margin-bottom: 0px;”><span style=“color: rgb(0, 65, 130); font-family: Arial,sans-serif; font-size: 7.5pt;”>
</span></strong></p><p style=“margin-top: 0px; margin-bottom: 0px;”><span style=“color: rgb(0, 65, 130); font-family: Arial,sans-serif; font-size: 7.5pt;”>
</span></strong></p><p style=“margin-top: 0px; margin-bottom: 0px;”><span style=“color: rgb(0, 65, 130); font-family: Arial,sans-serif; font-size: 7.5pt;”>
</span></strong></p><p style=“margin-top: 0px; margin-bottom: 0px;”><span style=“color: rgb(0, 65, 130); font-family: Arial,sans-serif; font-size: 7.5pt;”>
</span></strong></p><p style=“margin-top: 0px; margin-bottom: 0px;”><span style=“color: rgb(0, 65, 130); font-family: Arial,sans-serif; font-size: 7.5pt;”>Imprima somente se necess\u00E1rio</span></strong></p><p style=“margin-top: 0px; margin-bottom: 0px;”><span style=“color: rgb(0, 65, 130); font-family: Arial,sans-serif; font-size: 7.5pt;”>\t\t\tEsta mensagem cont\u00E9m informa\u00E7\u00E3o confidencial e somente para quem \t\t\testa foi destinada. Caso voc\u00EA n\u00E3o seja o destinat\u00E1rio da mensagem, \t\t\tfavor informar-nos imediatamente. Ela n\u00E3o deve ser lida, \t\t\tretransmitida, disseminada ou utilizada de qualquer forma por \t\t\tpessoas ou entidades outras que n\u00E3o o destinat\u00E1rio. Nenhuma forma de \t\t\tcontrata\u00E7\u00E3o resultar\u00E1 desta mensagem, at\u00E9 que documentos/contratos \t\t\tsejam assinados em nome da empresa. A Haztec Tecnologia e \t\t\tPlanejamento Ambiental SA n\u00E3o se responsabiliza por mensagens \t\t\ttransmitidas atrav\u00E9s de redes p\u00FAblicas. </span>\t\t\t <span style=“color: rgb(0, 65, 130); font-size: 10pt;”> </span></p><p style=“margin-top: 0px; margin-bottom: 0px;”> </p><p style=“margin-top: 0px; margin-bottom: 0px;”><span lang=“en-us”><font color="#004182" size=“1”><span style=“font-family: Arial,sans-serif; font-weight: 700;”>Print \t\t\tonly if necessary</span></font></span></p><p style=“margin-top: 0px; margin-bottom: 0px;”><span lang=“EN-US” style=“color: rgb(0, 65, 130); font-family: Arial,sans-serif; font-size: 7.5pt;”>\t\t\tThis e-mail contains confidential information for the addressee \t\t\tonly. If you are not the intended recipient, please notify us \t\t\timmediately. You should not use, disclose, distribute or copy this \t\t\tcommunication if received in error. No binding contract will result \t\t\tfrom this e-mail until such time as a written document is signed on \t\t\tbehalf of the company. Haztec Tecnologia e Planejamento Ambiental SA \t\t\tcannot accept any responsibility for the completeness or accuracy of \t\t\tthis message as it has been transmitted over public networks.</span></p></td></tr></tbody></table></td></tr></table></td></tr><tr valign=“top” ><td style=" background-color:#FFFFFF; bEditID:r4st1; bLabel:accent2; height:0;"></td></tr><tr valign=“top” ><td style=" background-color:#FFFFFF; bEditID:r5st1; bLabel:footer; vertical-align:top; height:100; text-align:left;"></td></tr><tr valign=“top” ><td style=" background-color:#FFFFFF; bEditID:r6st1; bLabel:accent3; height:0;"></td></tr></table></center><img src="http://na23.salesforce.com/servlet/servlet.ImageServer?oid=00DG0000000kj2I&esid=0181600000Ocf1F"></body></html>",
“DESCRIPTION_TYPE”: 3
},
{
    "OWNER_TYPE_ID": 2,
    "OWNER_ID": 909, 
    "TYPE_ID": 4, 
    "COMMUNICATIONS": [ { "VALUE":"hudson.medeiros@haztec.com.br"}, { "VALUE":"bruno.silva@haztec.com.br"} ],
    "SUBJECT": "Teste por API 11",
    "COMPLETED": "Y",
    "PRIORITY": 2, 
    "RESPONSIBLE_ID": 45,
    "DESCRIPTION": "<h1>b</h1>",
    "DESCRIPTION_TYPE": 3
}

]

Someone can help me?

Hi and welcome to the Postman community hrmedeiros!

Have you tried using single quotes for the JSON part and double quotes for the HTML part?

Something like that:

[{
'OWNER_TYPE_ID': 2,
'COMMUNICATIONS”': [ 
{ 'VALUE':'email@email.com'}, 
'DESCRIPTION': 'p{margin-top:0px; margin-bottom:0px;}</style><body class="setupTab" style="background-color:#FFFFFF; bEditID:b1st1; bLabel:body;">'
// rest of your code here

Hello!
The JSON is correct. But Postman always interpret as pure HTML.

I solved with a pre-request script like

pm.environment.set('VAR_DESCRIPTION', JSON.stringify(data['DESCRIPTION']));

Thanks for your help :slight_smile:

1 Like