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.

Parsing Campaign Event Resource XML file

Highlighted
Occasional Advisor

Parsing Campaign Event Resource XML file

Hi,

      How to parse the Campaign Event Resource XML file using c# in order to retrive all the <EmailAddress>values@values.com</EmailAddress> node values...

 

 

<?xml version="1.0" encoding="UTF-8" ?>
- <feed xmlns="http://www.w3.org/2005/Atom">
  <id>http://api.test.com/ws/customers/example%40example.com/campaigns/1113523964608/events/opens</id>
  <title type="text">Opens Events for Customer: ashwin@test.com, Campaign id: 1113523964608</title>
  <link href="opens" />
  <link href="opens" rel="self" />
  - <author>
    <name>ashwin@test.com</name>
  </author>
  <updated>2013-05-27T12:39:18.624Z</updated>
  <link href="/ws/customers/ashwin%40test.com/campaigns/1113523964608/events/opens" rel="first" />
  <link href="/ws/customers/ashwin%40test.com/campaigns/1113523964608/events/opens" rel="current" />
  - <entry>
    <id>http://api.test.com/ws/customers/example%40example.com/events/opens/1113523964608,64,1369309885000</id>
    <title type="text">Email Open Event for Customer: ashwin%40test.com, Campaign: http://api.test.com/ws/customers/example%40example.com/campaigns/1113523964608</title>
    <updated>2013-05-23T11:51:25.000Z</updated>
    - <author>
      <name>Constant Contact</name>
    </author>
    - <content type="application/vnd.ctct+xml">
      - <OpenEvent xmlns="http://ws.test.com/ns/1.0/" id="http://api.test.com/ws/customers/example%40example.com/events/opens/1113523964608,64,1369309885000">
        - <Contact id="http://api.test.com/ws/customers/example%40example.com/contacts/64">
          <EmailAddress>hanumantharaotvs@test.com</EmailAddress>
          <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/ashwin%40test.com/contacts/64" rel="self" />
        </Contact>
        - <Campaign id="http://api.test.com/ws/customers/example%40example.com/campaigns/1113523964608">
          <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/ashwin%40test.com/campaigns/1113523964608" rel="self" />
          <Name>2013-05-23T09:04:51.7031250Z</Name>
        </Campaign>
        <EventTime>2013-05-23T11:51:25.000Z</EventTime>
      </OpenEvent>
    </content>
  </entry>
  - <entry>
    <id>http://api.test.com/ws/customers/example%40example.com/events/opens/1113523964608,46,1369300552000</id>
    <title type="text">Email Open Event for Customer: ashwin%40test.com, Campaign: http://api.test.com/ws/customers/example%40example.com/campaigns/1113523964608</title>
    <updated>2013-05-23T09:15:52.000Z</updated>
    - <author>
      <name>Constant Contact</name>
    </author>
    - <content type="application/vnd.ctct+xml">
      - <OpenEvent xmlns="http://ws.test.com/ns/1.0/" id="http://api.test.com/ws/customers/example%40example.com/events/opens/1113523964608,46,1369300552000">
        - <Contact id="http://api.test.com/ws/customers/example%40example.com/contacts/46">
          <EmailAddress>dileep.pingeli@test.com</EmailAddress>
          <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/ashwin%40test.com/contacts/46" rel="self" />
        </Contact>
        - <Campaign id="http://api.test.com/ws/customers/example%40example.com/campaigns/1113523964608">
          <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/ashwin%40test.com/campaigns/1113523964608" rel="self" />
          <Name>2013-05-23T09:04:51.7031250Z</Name>
        </Campaign>
        <EventTime>2013-05-23T09:15:52.000Z</EventTime>
      </OpenEvent>
    </content>
  </entry>
  - <entry>
    <id>http://api.test.com/ws/customers/example%40example.com/events/opens/1113523964608,2,1369300543000</id>
    <title type="text">Email Open Event for Customer: ashwin%40test.com, Campaign: http://api.test.com/ws/customers/example%40example.com/campaigns/1113523964608</title>
    <updated>2013-05-23T09:15:43.000Z</updated>
    - <author>
      <name>Constant Contact</name>
    </author>
    - <content type="application/vnd.ctct+xml">
      - <OpenEvent xmlns="http://ws.test.com/ns/1.0/" id="http://api.test.com/ws/customers/example%40example.com/events/opens/1113523964608,2,1369300543000">
        - <Contact id="http://api.test.com/ws/customers/example%40example.com/contacts/2">
          <EmailAddress>dileep@test.com</EmailAddress>
          <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/ashwin%40test.com/contacts/2" rel="self" />
        </Contact>
        - <Campaign id="http://api.test.com/ws/customers/example%40example.com/campaigns/1113523964608">
          <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/ashwin%40test.com/campaigns/1113523964608" rel="self" />
          <Name>2013-05-23T09:04:51.7031250Z</Name>
        </Campaign>
        <EventTime>2013-05-23T09:15:43.000Z</EventTime>
      </OpenEvent>
    </content>
  </entry>
</feed>

 

1 REPLY 1
Highlighted
Employee

Re: Parsing Campaign Event Resource XML file

Hi,

 

As I mentioned, it might be better to switch to our newer .net sdk since it has some methods built in that I think will help (and it will be supported longer).  If you want to use the XML-based API and wrapper though, here is an example of how to parse XML with C#.

 

Best Regards,

Shannon W.

API Support Specialist

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