webservices

Listing All Contacts

by Administrator on ‎03-25-2011 09:54 AM

You can get a list of all contacts in your account by using the GET method on the contacts collection:

 

https://api.constantcontact.com/ws/customers/{username}/contacts 

 

To get a list of contacts for a particular list, you need to utilize API for listing members of a contact list.  Please refer to documentation for listing members.

 

Each contact is returned in <entry> element, and if there are more than one contact in the account, there will be mutliple <entry> returned.  Each <entry> provides only the basic information about a contact.  Each API call returns 50 contacts at a time.  In order to obtain the rest of the contacts, you need to page through all the remaining pages by constructing the URI for the next page using the value in <link> element with attribute rel="next".

 

In order to obtain more details of a contact, you need to use the GET method on the contact resource itself.  To get the URI for the contact resource for a contact, look for <link> element with attribute rel="edit" in an <entry> for a contact, and conscrutct the URI for the resource, which would look like the following:

 

https://api.constantcontact.com/ws/customers/{username}/contacts/{contact-id}  

If you call the above URI with the GET method, you will get more details for a particular contact.  To learn more about how to get information on a particular contact, refer to Obtaining a Contact's Information.