Mailerlite custom http API call fails

Hey there,

I’m having an issue making a POST request to the Mailerlite API to create a campaign that includes HTML.

I’m using the NEW version of Mailerlite. What I find strange is that my call is successful if I don’t include “email content”, but the moment I include plain html it fails. I’ve followed Mailerlite’s direction to remove line breaks, use single quotes, and to use a tool to escape the HTML.

When I submit the exact same body content in a call via Postman (same headers, etc.) it is successful.

Any ideas why the Make http module would fail while Postman is fine?

{
  "name": "TFN #201 – Test",
  "type": "regular",
  "emails": [
    {
      "subject": "Test",
      "from_name": "Name,
      "from": "emai@domain.com",
      "content": "HTML CONTENT HERE"
    }
  ],
  "segments": [78396021595440795]
}

Hi @Sean.N , in the value of “from_name”, I see that you are missing a closing quote.

Regardless of that, I think what happens to you is that adding the HTML code breaks the JSON, you can check if the HTML tags are with single quotes, so you don’t have a problem.

1 Like

Hi. In the next time use a tool like Jsonlint.com to check the json code and prevent errors like in the field “from_name”. And as Francisco says, be sure about the html code sent in the field “content”. If there is some kind of the quotes, you need to turn it into single quotes.


Thanks, Helio!
Wemakefuture
If you have questions reach out :wink:

2 Likes

@Francisco_Fontes @Wemakefuture Thanks for the responses!

It looks like in my original call, I wasn’t missing the closing quote. When I pasted into the forum, I made a typo when removing some of the sensitive info like the real email address and name.

I double checked that my HTML includes no line breaks, and that I’m using single quotes. Things work appropriately in Postman, but still not in Make. Is there anything else I should be looking for?

1 Like

The best way to check your JSON payload is to copy and paste it in https://jsoneditoronline.org/

I did that and found a few issues in your JSON payload. Fix it and try again.

1 Like