I have managed to figure out how to create templates using the API, sending key:value pairs to the API endpoint, successfully created the template name etc in the Mailwizz application, success = 201 and I get the unique templet ID back, however the HTML sent is being corrupted, even for a simply HTML test code:
<body><h1>Hello</h1></body>.
Response is:
{
"status": "success",
"template_uid": "kt6583oed87c0"
}
I have tried on postman as well, successfully creates template but again HTML in the template body is corrupted. I am sending Content-Type application/x-www-form-urlencoded; charset=UTF-8 and have tried without the charset UTF8 encoding as well. The full request is as follows, with URI and key obscured:
{
"uri": "https://[domain]/mailmanager/api/index.php/templates/create",
"method": "POST",
"headers": {
"X-Api-Key": "[key]",
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate, br"
},
"body": "template[name]=My%20API%20template1&template[content]=%3Cbody%3E%3Ch1%3EHello%3C%2Fh1%3E%3C%2Fbody%3E"
}
I get the template name correctly but the HTML is:
<body style="box-sizing: border-box; margin: 0;">?e
<title>
</title>
</body>
I have also tried Content-Type: application/json and text/plain and text/html and they fail with 422Unprocessable Entity (WebDAV) (RFC and if I try Content-Type = multipart/form-data I get 403Forbidden
<body><h1>Hello</h1></body>.
Response is:
{
"status": "success",
"template_uid": "kt6583oed87c0"
}
I have tried on postman as well, successfully creates template but again HTML in the template body is corrupted. I am sending Content-Type application/x-www-form-urlencoded; charset=UTF-8 and have tried without the charset UTF8 encoding as well. The full request is as follows, with URI and key obscured:
{
"uri": "https://[domain]/mailmanager/api/index.php/templates/create",
"method": "POST",
"headers": {
"X-Api-Key": "[key]",
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate, br"
},
"body": "template[name]=My%20API%20template1&template[content]=%3Cbody%3E%3Ch1%3EHello%3C%2Fh1%3E%3C%2Fbody%3E"
}
I get the template name correctly but the HTML is:
<body style="box-sizing: border-box; margin: 0;">?e
<title>
</title>
</body>
I have also tried Content-Type: application/json and text/plain and text/html and they fail with 422Unprocessable Entity (WebDAV) (RFC and if I try Content-Type = multipart/form-data I get 403Forbidden