Hi, I'm in the process of updating an application built using CakePHP v2.* that has been utilizing the v2 CC API (accessed through 'https://api.constantcontact.com/v2/) to access Email Campains. More specifically, the PHP application makes a GET call to the old API to grab the most recent Newsletter, here: https://sciencematters.tv/newsletters/current . The newsletter recently (in the past couple months) stopped populating. After looking at the response, it looks like the "link" the app receives is null, so nothing is displayed. The code used to find the latest newsletter is ....
$lastnewsletter = $this->find();
if($lastnewsletter != null){
$apiKey = Configure::read('constant_contact_key');
$token = Configure::read('constant_contact_token');
$cc = new ConstantContact($apiKey);
$campaign = $cc->getEmailCampaign($token, $lastnewsletter->id);
....
private function find($next = null){
$apiKey = Configure::read('constant_contact_key');
$token = Configure::read('constant_contact_token');
$tmp = 'api key is '.$apiKey;
$cc = new ConstantContact($apiKey);
$params = array('limit'=>50, 'modified_since'=>date('2013-05-01'), 'status'=>'SENT');
if($next != null){
$params = array('next' => $next);
}
$results = $cc->getEmailCampaigns($token, $params);
foreach($results->results as $result){
if(isset($result->name) && strpos($result->name,'9287_newsletter') !== false){
return $result;
}
}
if($results->next != null){
return $this->find($results->next);
}
} the 'constant_contact-key' and 'constant-contact_token' are static. This doesn't seem to be how things work now. The goal is to move to the most recent version of the API (v3). So, I have two questions: 1) Are calls to the v2 API completely defunct? Is there any obvious reason the newsletter is no longer working? 2) Since the process to access email compaigns looks like it changes with respect to the access token, are there any resources with PHP examples on what this process looks like? Thank you for any assistance.
... View more