The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

Retreiving list of campaign or contact events

SOLVED
Go to solution
Highlighted
Occasional Contributor

Retreiving list of campaign or contact events

Hello again,

 

Sorry to need help again so quickly.

 

I want to pull a list of events related to a campaign.  I used what I think is the proper URL... https://api.constantcontact.com/ws/customers/<user>/campaigns/<campaignid>/events/?access_token=<token>

 

But the XML I get back does not really have any data in it as far as numbers or anything.  It looks like this....

 

<?xml version="1.0" encoding="UTF 8" ?>
  <service xmlns="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom">
  <workspace>
  <atom:title type="text">Constant Contact Web Services Event Workspace</atom:title>
  <collection href="/ws/customers/<user>/campaigns/<campaignid>/events/bounces">
  <atom:title type="text">Bounce Events for Customer: <user>, Campaign id: <campaignid></atom:title>
  <accept>application/atom+xml; type=entry</accept>
  </collection>
  <collection href="/ws/customers/<user>/campaigns/<campaignid>/events/sends">
  <atom:title type="text">Send Events for Customer: <user>, Campaign id: <campaignid></atom:title>
  <accept>application/atom+xml; type=entry</accept>
  </collection>
  <collection href="/ws/customers/<user>/campaigns/<campaignid>/events/optouts">
  <atom:title type="text">Opt out Events for Customer: <user>, Campaign id: <campaignid></atom:title>
  <accept>application/atom+xml; type=entry</accept>
  </collection>
  <collection href="/ws/customers/<user>/campaigns/<campaignid>/events/forwards">
  <atom:title type="text">Forwards Events for Customer: <user>, Campaign id: <campaignid></atom:title>
  <accept>application/atom+xml; type=entry</accept>
  </collection>
  <collection href="/ws/customers/<user>/campaigns/<campaignid>/events/opens">
  <atom:title type="text">Opens Events for Customer: <user>, Campaign id: <campaignid></atom:title>
  <accept>application/atom+xml; type=entry</accept>
  </collection>
  </workspace>
  </service>

 

If I pull a list of events for contacts, I get something very similar.  The XML is there but there is no information on number of events or anything like that.  Does this part work?

 

Thank you again for any guidance.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Trusted Contributor

Re: Retreiving list of campaign or contact events

Hello,

 

No problem at all with your question frequency. This call for events returned only links to the collection for various event types (href attribute in the <collection> elements for each event type). You can run a GET against the events collection using the base API url, plus the path specified in the href attribute value.  Essentially, it's the same you've made your call to, but with "/bounces" or "/opens" appended to the path for a given campaign.  If what you are looking for is the number of each type of event, as provided through the User Interface on the email reports page for each campaign, you can make a call for the campaign resource, i.e., 

 

https://api.constantcontact.com/ws/customers/{UserName}/campaigns/{CampaignID}

 

That will return numbers of each type of events, plus if any clicks have occurred on tracked links in the email, url's are provided in the response for use in making additional calls to drill down into the click-thru statistics.

 

I hope this information is helpful.  It's explained in the campaign events resource documentation. t/he behavior of the contact events service mostely paralleles this behavior (see here).

Mark Coleman
Support Engineer

View solution in original post

2 REPLIES 2
Highlighted
Trusted Contributor

Re: Retreiving list of campaign or contact events

Hello,

 

No problem at all with your question frequency. This call for events returned only links to the collection for various event types (href attribute in the <collection> elements for each event type). You can run a GET against the events collection using the base API url, plus the path specified in the href attribute value.  Essentially, it's the same you've made your call to, but with "/bounces" or "/opens" appended to the path for a given campaign.  If what you are looking for is the number of each type of event, as provided through the User Interface on the email reports page for each campaign, you can make a call for the campaign resource, i.e., 

 

https://api.constantcontact.com/ws/customers/{UserName}/campaigns/{CampaignID}

 

That will return numbers of each type of events, plus if any clicks have occurred on tracked links in the email, url's are provided in the response for use in making additional calls to drill down into the click-thru statistics.

 

I hope this information is helpful.  It's explained in the campaign events resource documentation. t/he behavior of the contact events service mostely paralleles this behavior (see here).

Mark Coleman
Support Engineer

View solution in original post

Highlighted
Occasional Contributor

Re: Retreiving list of campaign or contact events

Thank you.  Makes perfect sense now!

Developer Portal

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

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured