updateContact using V2

Regular Participant

updateContact using V2

I am trying to update the contact using the code:

$contact = new Contact();
$contact->id = $Customer['ContactId'];
$contact->first_name = $allCustomers[$i]['first_name'];
$contact->last_name = $allCustomers[$i]['last_name'];
$cc->contactService->updateContact($params['token'], $contact);

But got error:  Ctct\Exceptions\CtctException: Forbidden 

How I prepare the $contact object, for passing to updateContact function.


I can't use

$contactData = $cc->contactService->getContacts($params['token'], array("email" => 'someemail@domain.com'));
$contact = $contactData->results[0];

since it gives error (i don't know the reason).


So I decided to create the $contact object for update. I know the contact id and email of contact to update. 






Your second code sample is the correct way to code the call. I'm wondering if there may be an underlying factor that is causing the error. Please try using our API Tester to get your contact by email address: https://constantcontact.mashery.com/io-docs


If you're getting an error response, please email us at webservices@constantcontact.com with the API Key, Access Token, and the email address you are working with when you get this error so that I can dig in further.




David B.
Tier II API Support Engineer

Developer Portal

View API documentation, code samples, get your API key.

Visit Page