We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

Calling CC API based on CustomField Data


Calling CC API based on CustomField Data

I'm working on a PHP script that pulls all contact data based on criteria of their custom fields.


I've tried doing criteria calls to this resource (https://api.constantcontact.com/ws/customers/4obrien/contacts) but noticed that I can only use criteria that the script actually will output (for example, a specific email address or email type but not first or last name because thats concatenated into the name field). Any suggestions?


At this point by my idea is to write a script that will recursively call all data, the access each individual contacts data, and go through the pages 50 contacts at a time but geeeez that would be literally well over a thousand API calls in a short period of time which just seems like asking for trouble. Even if I stored them in a temp database and after each run it would only pull ones that have changed that would make future calls easier but still just seems like a lot of trouble.


We're definitely looking at implementing more search features, specifically around custom fields, to make syncing data easier.  Unfortunately, today the only way to get that information is to either poll through all contacts like you mentioned or to use our Bulk API to create an asyncronous job for pulling all the contacts and their associated data.  In all honesty, this is probably the easier way to seed your data locally and then you can implement the syncing feature you mentioned. 



Dave Berard
Senior Product Manager, Constant Contact
Developer Portal

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

Visit Page