Some of our customers are experiencing difficulty logging in. We are aware of this issue and are working to resolve it as quickly as we can.

Parsing Campaign Event Resource XML file

AshwinY
Member

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
Shannon_W
Employee

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