Hey, guys I am building a tool for sending Newsletter with HTML emails, I am using the SendGrid API, however, the HTML I scrape comes like this (link below):
POST https://api.sendgrid.com/v3/templates/[template id]/versions
{
"active": 1,
"name": "<Your Version Name>",
"html_content": "<Your HTML Content>",
"plain_content": "<Your Plain Text Content>",
"subject": "<Your Email Subject>",
"editor": "code"
}
When I send it via API I get:
There was an issue setting up your call.
Raw response for the API
Status code 400
{"error":"The request could not be completed due to malformed JSON."}
When I paste it manually in SendGrid as a template version it works perfectly.
“” will break when JSON incompatible characters are used in the parameter. Almost all the time, inputs in API calls should be surrounded by no quotation marks, and should be :formatted as JSON safe in the API call action in the workflow (which guarantees your JSON is always valid)