Get campaigns between two dates

Member

Get campaigns between two dates

Is there an easy way to get campaigns between two dates? I'm using /emailmarketing/campaigns but I want to use a start and end date. 

 

I could just pull all campaigns since the start date and then parse through and discard all of the campaigns after the end date, but that could be a lot of processing depending on the dates.

 

For example I want to be able to pull all campaigns from 01-01-2014 through 03-31-2014

 

Right now I'd have to do this: 

https://api.constantcontact.com/v2/emailmarketing/campaigns?status=SENT&modified_since=2014-01-01

But that'd give me everything from Jan 1 through today. This gets worse the farther back the start date is. I'm working on a reporting tool and I'd like to automate some comparisons, so compare open rates, # of campaigns sent, etc, from Q1 2013 with Q2 2014, and so on.

But I really don't want to have to get 1 1/2 - 2 years worth of campaigns and then pull out just the ones I want. 


So is there a way to specify a date range? I couldn't find anything in the documentation. 

Jake Burns
An award-winning, Master Certified partner and is the founder of SouthDirekt, a Tampa-based internet marketing firm.
1 REPLY 1
Member

Hello,

 

At this time our API only supports the ability to limit time ranges by a recently modified parameter and there us not a method available for explicitly time-boxing. While it may not resolve the problem, it is worth mentioning that the results from the modified_since campaigns request is sorted from newest to oldest. You could potentially use this to speed up the algorithm which fetches campaigns from the account so that it can move quickly through pages of results until it finds the right date range.

 

Outside of that, the next best thing might be to take an initial inventory of an account's email addresses and store some simple meta-data such as campaign IDs and the date they were sent. That would allow you to quickly re-asses those campaigns once loaded.

 

If you do have any more questions or if I can assist at with understanding this, please let me know!

 

Sincerely,

Elijah G.
API Support Engineer
Developer Portal

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

Visit Page