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