Get full contact details using getContacts

Occasional Contributor

Get full contact details using getContacts

Hi Ryan,


I am using getContacts method of CC wraper to get all contacts.


I am getting below details. Apart from these i need firstname, lastname and lists. Is there any way to get full details of contacts using getContacts() method of the wrapper class. If not is there any other function to retreive full details of all the contacts instead of calling getContactDetails() multiple times to get details of each contact.


[link] => /ws/customers/username/contacts/1
    [id] =>
    [updated] => 2012-01-20T12:20:42.253Z
    [status] => Active
    [emailAddress] =>
    [emailType] => HTML
    [firstName] => 
    [middleName] => 
    [lastName] => 
    [fullName] => 
    [jobTitle] => 
    [companyName] => 
    [homePhone] => 
    [workPhone] => 
    [addr1] => 
    [addr2] => 
    [addr3] => 
    [city] => 
    [stateCode] => 
    [stateName] => 
    [countryCode] => 
    [countryName] => 
    [postalCode] => 
    [subPostalCode] => 
    [notes] => 
    [customField1] => 
    [customField2] => 
    [customField3] => 
    [customField4] => 
    [customField5] => 
    [customField6] => 
    [customField7] => 
    [customField8] => 
    [customField9] => 
    [customField10] => 
    [customField11] => 
    [customField12] => 
    [customField13] => 
    [customField14] => 
    [customField15] => 
    [contactLists] => 
    [confirmed] => 
    [optInSource] => ACTION_BY_CUSTOMER
    [lists] => Array
CTCT Employee

Re: Get full contact details using getContacts



You can do this by setting getContacts to a var and doing a foreach and on each instance you would do a getContactDetails to that Contact.  That would return the more detailed information.


Here is an example that works with


// Store your contacts into $Contacts
$Contacts = $ConstantContact->getContacts();

// for every contact found in $Contacts['contacts'] array set instance of $Contact
foreach($Contacts['contacts'] as $Contact){
// set $temp to get details of Contact
    $temp = $ConstantContact->getContactDetails($Contact);
// All details are available now through $temp
    echo $temp->firstName;


Ryan Davis
Quality Engineer
Developer Portal

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

Visit Page

Constant Contact Would Like To Hear From You!

We want to hear from customers like you about your favorite features and how they have helped your business or organization. Tell us by answering a few questions in...

Read More