webservices

Retrieving a Contact List Collection

by Administrator on ‎03-25-2011 09:56 AM

To retrieve the collection of contact lists for the UserName joesflowers, you perform an HTTP GET on the collection URI, https://api.constantcontact.com/ws/customers/joesflowers/lists in this example, which returns the following XML document:

 

 

<feed xmlns="http://www.w3.org/2005/Atom">
  <id>http://api.constantcontact.com/ws/customers/joesflowers/lists</id>
  <title type="text">Contact Lists</title>
  <link href="" />
  <link href="" rel="self" />
  <author>
    <name>Constant Contact Web Services</name>
  </author>
  <updated>2008-04-16T13:07:13.453Z</updated>
  <link href="lists?next=6" rel="next" />
  <link href="lists" rel="first" />
  <link href="lists" rel="current" />
  <entry>
    <link href="/ws/customers/joesflowers/lists/1" rel="edit" />
    <id>http://api.constantcontact.com/ws/customers/joesflowers/lists/1</id>
    <title type="text">General Interest</title>
    <updated>2008-04-16T13:07:14.057Z</updated>
    <content type="application/vnd.ctct+xml">
      <ContactList xmlns="http://ws.constantcontact.com/ns/1.0/"
          id="http://api.constantcontact.com/ws/customers/joesflowers/lists/1">
        <OptInDefault>false</OptInDefault>
        <Name>General Interest</Name>
        <ShortName>General Interest</ShortName>
        <DisplayOnSignup>Yes</DisplayOnsignup>
        <SortOrder>1</SortOrder>
        <Members id="http://api.constantcontact.com/ws/customers/joesflowers/lists/1/members"></Members>
      <ContactCount>42</ContactCount>
      </ContactList>
    </content>
  </entry>
  <entry>
    <link href="/ws/customers/joesflowers/lists/2" rel="edit" />
    <id>http://api.constantcontact.com/ws/customers/joesflowers/lists/2</id>
    <title type="text">Recent Signups</title>
    <updated>2008-04-16T13:07:14.061Z</updated>
    <content type="application/vnd.ctct+xml">
      <ContactList xmlns="http://ws.constantcontact.com/ns/1.0/"
          ?id="http://api.constantcontact.com/ws/customers/joesflowers/lists/2">
        <OptInDefault>false</OptInDefault>
        <Name>Recent Signups</Name>
        <ShortName>Recent Signups</ShortName>
        <DisplayOnSignup>No</DisplayOnsignup>
        <SortOrder>2</SortOrder>
        <Members id="http://api.constantcontact.com/ws/customers/joesflowers/lists/2/members"></Members>
        <ContactCount>712</ContactCount>
      </ContactList>
    </content>
  </entry>
</feed> 

 

The response is made up of a feed element which contains some metadata about the feed followed by a series of entry elements. Each entry is made up of some metadata followed by a content element. Inside the content element is a ContactList element which describes the attributes of a particular contact list. The structure of the Atom elements is described in detail by RFC 4287.  The user contact lists are ones created by the user, including "General Interests" list, which is created by default.  The system contact lists include "Active", "Removed" and "Do-Not-Mail".  You cannot manipulate the system contact lists directly as they simply indicate the status of each contact, but we provide them in the contact list collection to give you an ability to query all active, removed or opted-out contacts.