Retreiving list of campaign or contact events

SOLVED
Go to solution
Stat
Regular Participant

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
Mark-C
Member

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
Mark-C
Member

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

Stat
Regular Participant

Thank you.  Makes perfect sense now!

Developer Portal

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

Visit Page