webservices

Retrieving an Individual List

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

An individual list entry may be retrieved by issuing an HTTP GET to the entry's URI. The URI may be obtained from the Location header after creating a new entry or from the link element with rel="edit" attribute in an existing entry. A typical entry looks like this:

 

 

<entry xmlns="http://www.w3.org/2005/Atom">
  <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-16T18:39:35.710Z</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>
      <SortOrder>1</SortOrder>
    </ContactList>
  </content>
  <source>
    <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-16T18:39:35.717Z</updated>
  </source>
</entry> 

 

Note that the id, title, author and updated elements must be present in the XML in order to conform to the Atom specification, even though their values will be replaced by the server. The <id> element must have an acceptable format (<id>data:,<id> will work). The title and author elements may be empty. The id must contain a URI, but since the value is not used by the server, any URI will work. The server does not check for uniqueness. The updated element must contain a date or date/time value, but again the value is not used by the server.

If the new list is created successfully, the server will return an HTTP status of 201 Created. The HTTP Location header in the response will contain the URI of the newly created List, and the entity body returned will be the entry for the list, including server-generated values like ids and links:

 

 

<entry xmlns="http://www.w3.org/2005/Atom">
  <id>http://api.constantcontact.com/ws/customers/joesflowers/lists/15</id>
  <title type="text">A New List</title>
  <author />
  <updated>2008-04-16T15:28:09.757Z</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/15">
      <OptInDefault>false</OptInDefault>
      <Name>Test list 5</Name>
      <SortOrder>1</SortOrder>
      <ShortName>Test list 5</ShortName>
    </ContactList>
  </content>
  <link href="/ws/customers/joesflowers/lists/15" rel="edit" />
</entry>