Reply
New Member
akent
Posts: 1
Registered: ‎02-11-2011

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!).

CTCT Employee
David_J
Posts: 510
Registered: ‎06-04-2009

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 http://status.constantcontact.com 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

Participant
stickey
Posts: 12
Registered: ‎10-14-2010

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?

Participant
stickey
Posts: 12
Registered: ‎10-14-2010

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.

CTCT Employee
bsoder
Posts: 440
Registered: ‎06-05-2009

campaign xml

Hello,



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
Participant
stickey
Posts: 12
Registered: ‎10-14-2010

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);
24
25 // then run through preg_replace removing consecutive spaces
26 $params = preg_replace('/\s{2,}/', '', $params);
27 }
28
29 $campaign = new CCCampaign($params);
30 $campaigns = new CCCampaignsCollection();
31 $return = $campaigns->createCampaign($campaign);
32