In recognition of Martin Luther King Day, our Support Centers will be open with limited hours on Monday (1/18) from 10AM ET to 6PM ET. Visit our Help Center to see all of the ways you can find answers to your questions.
I'm integrating the Constant Contact API V3 and I'm able to add new contacts and update existing ones. I need to however, determine if they already exist so I can either add new or update the existing contact. At first I thought I could use the /contacts/sign_up_form endpoint, but the syntax is slightly different between the /contacts and /contacts/sign_up_form. Hence why I need to determine beforehand to either update, or add new so I can use a different set of JSON data. When I execute the following, all I get returned is a 1 no matter if they exist or not. // check if email already exists
$encodedEmail = urlencode($ccEmail);
$url = 'https://api.cc.email/v3/contacts?status=all&email=' .$encodedEmail. '&include_count=false' ;
$ch = curl_init();
$header = array ();
$header = 'Accept: application/json' ;
$header = 'Authorization: Bearer ' .$accessToken;
$header = 'Content-Type: application/json' ;
$header = 'Cache-Control: no-cache' ;
$header = 'Postman-Token: ' .$APIkey;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$response = curl_exec($ch);
curl_close($ch); According to the documentation, I should get either an empty array if they do NOT exist and an object with user data if they DO exist. See: https://v3.developer.constantcontact.com/api_guide/contacts_create.html Not sure what I'm missing here. I'm refreshing the access token on every call, so I know it's not that, otherwise I would probably get an unauthorized error. Can anybody shed light on this?
... View more
I've got it working, but my only issue is refreshing the token after expiration without granting permission again, either 2 hours after use or 24 hours without being used. If I generate it initially, then keep submitting the form it works fine, but that's not realistic. Can I run a cron job to somehow keep the token alive?
... View more