The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

Another 400 error when creating a campaign.

Highlighted
Occasional Participant

Re: Another 400 error when creating a campaign.

When I change to just a hello page, it works for me. 

Highlighted
Employee

Re: Another 400 error when creating a campaign.

It sounds like the issue is that your server is cutting off the request because of the length of the email content node, so we're not getting the full request. 

Highlighted
Occasional Participant

Re: Another 400 error when creating a campaign.

Yes I can send a plain email. I definitely think it's the character encoding that is killing me. Is it possible to create a campaign with a UTF-16 encoding?

Highlighted
Honored Contributor

Re: Another 400 error when creating a campaign.

Hello Mark,

 

Unfortunately the API and our emails are handled using UTF-8 for content encoding. Because of this, even if your data was sent using UTF-16, it is very likely that it would not be interpreted correctly if it was accepted at all.

 

After spending some time investigating the cause, there were several accented characters and some other unencoded characters that were being submitted and were not accepted by Constant Contact. To correct this, I used the PHP htmlentities function with the following flags to re-encode the contents:

htmlentities($content, ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE)

 

After doing this, the code was accepted by the API and submitted properly. You can view an updated XML request with this information here:

https://gist.github.com/anonymous/fa5a6670f115c5fbc88f

 

Sincerely,

Elijah G.

Tier 2 Support

Elijah G.
API Support Engineer
Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured