webservices

Searching for a Contact by Email Address

by Administrator on ‎03-25-2011 10:12 AM

To find particular contacts by email addresses, you can query the contact collection with a query parameter:

 

https://api.constantcontact.com/ws/customers/{username}/contacts?email={email-address}  

For example, to look up the entry for a contact with email address u89439@example.com, you would use the GET method on:

 

 

https://api.constantcontact.com/ws/customers/joesflowers/contacts?email=u89439%40example.com

 

Note that the email address must be properly URL encoded, as shown above with '@' sign being translated into %40.  The period does not need to be encoded.

 

If a contact with that email exists, the query will return the contact's <entry>, the same way it would be returned when you query the contacts collection.  In order to get the contact details, you need to query the contact resource itself. If no Contact with that email address exists, the API will return either a 500 error (Server Error) code or will return an empty feed (i.e. a feed with no entries).

You can find multiple contacts with a single query by simply adding additional parameters:

 

 

https://api.constantcontact.com/ws/customers/joesflowers/contacts?email=u89439%40example.com&email=u...

 

Just like before, the returned feed will contain entries for any Contacts that are found. Any that don't exist will simply be skipped.

 

Since all email addresses in Constant Contact are stored in lowercase, please lowercase the email address you use for your query parameter.  If not, your case will not match and your query will not work.