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.

API Problem, draft campaigns not being created

New Member

API Problem, draft campaigns not being created

We currently have an integration with the Constant Contact API that allows a user to submit a new campaign (with template) to CC from our site.  Currently the API seems to be accessible, as we can retrieve account information (mail lists, verified email adresses, etc).  We get positive responses all the way through our process (which includes creating the campaign on CC).  But alas, a visit to CC shows no new campaign draft in the list.  This has been a working feature of ours for some time now, and has not changed on our end.

Is CC experiencing some sort of service outage? or has something in the API changed that we need to be aware of?

ps. the Constant Contact API needs a serious overhaul (JSON, please!).


Re: API Problem, draft campaigns not being created

While we did experience some downtime this week, we did not have any outages on the 11th. You can always visit to check the status of our services. We have not changed anything relating to campaign creation, so I am not sure why you're unable to create one with a process that worked previously. If you can send your code over to our webservices support team, we would be happy to take a look at this.

Regarding JSON response format, this is definitely something on our roadmap to do with our API, unfortunately I do not have a tentative date of when this will be available. We will certainly post on these forums when that occurs.

David J


Worked fine for months, dead for half a day, now fine again.

The previous poster and I are co-workers working on the same software package.  We are using your PHP library code to talk to the API.  Everything is functioning normally now.  We've not touched anything on our end.

You had mentioned that you had downtime but no outages on the 11th.  We, too, did not experience any downtime our outage on the 11th when talking to the API. Our API calls simply would not complete when trying to run the CCCampaignsCollection::createCampaign method.

We were able to successfully run CCSettingsCollection::listVerifiedAddresses method, however.  This held true across multiple CC accounts that we work with.  listVerifiedAddresses worked fine, createCampaign failed.

Any ideas as to why that would be?  I don't believe sending you code would be of any benefit.  We've not modified the library.  It has worked fine for months and then goes belly up for half a day.  Something on your end, perhaps? Other than an outage?  Can you please verify before we root through our code?


Just sent over working and failed versions of campaign create

I just sent over what is working and isn't working on campaign creations. This includes everything that is sent as the $parameter parameter of the CCUtility::httpRequest method after calling CCCampaigns::createCampaign.

Please take a look. I've been beating my head against a wall for several hours over this.


campaign xml


I received your XML and I sent a response through email. Let me know there if you have any questions regarding this! Thanks,

Benjamin Soder
NOC Analyst
Constant Contact

removing whitespace works

Hi Ben, thanks for getting back to me. I've removed white space from the EmailContent node and everything seems to be functioning now.  I don't recall seeing that in the docs anywhere but perhaps I overlooked it.

If anyone else happens on this in regarding to 400 errors returned, another thing to check is white space in your EmailContent node. Single spaces are ok.  Everything else I would ditch.  Some code:

21 if (isset($params)) {
22 // run through str_replace first as it is faster. remove CR, LF, CRLF, whatever PHP_EOL is set to, tabs
23 $params = str_replace(array("\r", "\n", "\r\n", PHP_EOL, "\t"), '', $params);
25 // then run through preg_replace removing consecutive spaces
26 $params = preg_replace('/\s{2,}/', '', $params);
27 }
29 $campaign = new CCCampaign($params);
30 $campaigns = new CCCampaignsCollection();
31 $return = $campaigns->createCampaign($campaign);
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