cancel
Showing results for 
Search instead for 
Did you mean: 

Campaigns Collection

Administrator

The campaigns collection refers to a group of campaigns available to a particular user.  By performing GET on the collection itself, you retrieve a list of campaigns.  By performing a POST on the collection, you can add a new campaign to the collection.

 

Request Format

 

GET https://api.constantcontact.com/ws/customers/{user-name}/campaigns

 

For more information about listing campaigns, refer to Managing Email Campaigns.

 

Response Format

 

<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns="http://www.w3.org/2005/Atom">
<id>http://api.constantcontact.com/ws/customers/joesflowers/campaigns</id>
<title type="text">Campaigns for customer: joesflowers</title>
<link href="campaigns" />
<link href="campaigns" rel="self" />
<author>
<name>joesflowers</name>
</author>
<updated>2009-10-19T18:55:01.918Z</updated>
<link href="/ws/customers/joesflowers/campaigns?next=2" rel="next" />
<link href="/ws/customers/joesflowers/campaigns" rel="current" />
<link href="/ws/customers/joesflowers/campaigns" rel="first" />
<entry>
<link href="/ws/customers/joesflowers/campaigns/1100546096289" rel="edit" />
<id>http://api.constantcontact.com/ws/customers/joesflowers/campaigns/1100546096289</id>
<title type="text">Spring Campaign</title>
<updated>2009-10-19T18:34:53.105Z</updated>
<author>
<name>Constant Contact</name>
</author>
<content type="application/vnd.ctct+xml">
<Campaign xmlns="http://ws.constantcontact.com/ns/1.0/" id="http://api.constantcontact.com/ws/customers/joesflowers/campaigns/1100546096289">
<Name>Spring Campaign</Name>
<Status>Sent</Status>
<Date>2009-10-19T18:34:53.105Z</Date>
</Campaign>
</content>
</entry>
<entry>
<link href="/ws/customers/joesflowers/campaigns/1100546028219" rel="edit" />
<id>http://api.constantcontact.com/ws/customers/joesflowers/campaigns/1100546028219</id>
<title type="text">Fall Campaign</title>
<updated>2009-10-16T13:55:48.369Z</updated>
<author>
<name>Constant Contact</name>
</author>
<content type="application/vnd.ctct+xml">
<Campaign xmlns="http://ws.constantcontact.com/ns/1.0/" id="http://api.constantcontact.com/ws/customers/joesflowers/campaigns/1100546028219">
<Name>Fall Campaign</Name>
<Status>Draft</Status>
<Date>2009-10-16T13:55:48.369Z</Date>
</Campaign>
</content>
</entry>
</feed>

 

Each <entry> elements represent a campagin.  A campaign's unique ID is given by <id> and the link that you should use to retrieve the details of a campaign is given in <link> with rel attribute value of "edit".  You should use the value of this <link> element concatenated after our server name.  From the above example, the constructed URI for the campaign is:

 

https://api.constantcontact.com/ws/customers/joesflowers/campaigns/1100546028219

Request Format

 

POST https://api.constantcontact.com/ws/customers/{user-name}/campaigns

To learn more about how to create a campaign, please refer to the Managing Email Campaigns.

 

The XML body must be passed as part of the request to describe the campaign that you would like to create.  The following shows an example of what the XML should look like.

 

<?xml version='1.0' encoding='UTF-8'?>
<entry xmlns="http://www.w3.org/2005/Atom">
<link href="/ws/customers/joesflowers/campaigns" rel="edit" />
<id>http://api.constantcontact.com/ws/customers/joesflowers/campaigns</id>
<title type="text">API Test Email</title>
<updated>2009-10-19T18:34:53.105Z</updated>
<author>
<name>Constant Contact</name>
</author>
<content type="application/vnd.ctct+xml">
<Campaign xmlns="http://ws.constantcontact.com/ns/1.0/"
id="http://api.constantcontact.com/ws/customers/joesflowers/campaigns/1100546096289">
<Name>API Test Email</Name>
<Status>Draft</Status>
<Date>2009-10-19T18:34:53.105Z</Date>
<Subject>Enter email subject here</Subject>
<FromName>joesflowers@example.com</FromName>
<ViewAsWebpage>NO</ViewAsWebpage>
<ViewAsWebpageLinkText></ViewAsWebpageLinkText>
<ViewAsWebpageText></ViewAsWebpageText>
<PermissionReminder>YES</PermissionReminder>
<PermissionReminderText>You're receiving this email because of your relationship with ctct.
Please &lt;ConfirmOptin>&lt;a style="color:#0000ff;">confirm&lt;/a>&lt;/ConfirmOptin>
your continued interest in receiving email from us.</PermissionReminderText>
<GreetingSalutation>Dear</GreetingSalutation>
<GreetingName>FirstName</GreetingName>
<GreetingString>Greetings!</GreetingString>
<OrganizationName>ctct</OrganizationName>
<OrganizationAddress1>123 wsw st</OrganizationAddress1>
<OrganizationAddress2></OrganizationAddress2>
<OrganizationAddress3></OrganizationAddress3>
<OrganizationCity>Ashland</OrganizationCity>
<OrganizationState>MA</OrganizationState>
<OrganizationInternationalState></OrganizationInternationalState>
<OrganizationCountry>us</OrganizationCountry>
<OrganizationPostalCode>32423</OrganizationPostalCode>
<IncludeForwardEmail>NO</IncludeForwardEmail>
<ForwardEmailLinkText></ForwardEmailLinkText>
<IncludeSubscribeLink>NO</IncludeSubscribeLink>
<SubscribeLinkText></SubscribeLinkText>
<EmailContentFormat>HTML</EmailContentFormat>
<EmailContent>&lt;html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"
xmlns:cctd="http://www.constantcontact.com/cctd">
&lt;body>&lt;CopyRight>Copyright (c) 1996-2009 Constant Contact. All rights reserved. Except as permitted under a
separate
written agreement with Constant Contact, neither the Constant Contact software, nor any content that appears on any
Constant Contact site,
including but not limited to, web pages, newsletters, or templates may be reproduced, republished, repurposed, or
distributed without the
prior written permission of Constant Contact. For inquiries regarding reproduction or distribution of any Constant
Contact material, please
contact joesflowers@example.com.&lt;/CopyRight>
&lt;OpenTracking/>
&lt;!-- Do NOT delete previous line if you want to get statistics on the number of opened emails -->
&lt;CustomBlock name="letter.intro" title="Personalization">
&lt;Greeting/>
&lt;/CustomBlock>
&lt;/body>
&lt;/html></EmailContent>
<EmailTextContent>&lt;Text>This is the text version.&lt;/Text></EmailTextContent>
<StyleSheet></StyleSheet>
<ContactLists>
<ContactList id="http://api.constantcontact.com/ws/customers/joesflowers/lists/1">
<link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/joesflowers/lists/1" rel="self" />
</ContactList>
</ContactLists>
<FromEmail>
<Email id="http://api.constantcontact.com/ws/customers/joesflowers/settings/emailaddresses/1">
<link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/joesflowers/settings/emailaddresses/1"
rel="self" />
</Email>
<EmailAddress>joesflowers@example.com</EmailAddress>
</FromEmail>
<ReplyToEmail>
<Email id="http://api.constantcontact.com/ws/customers/joesflowers/settings/emailaddresses/1">
<link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/joesflowers/settings/emailaddresses/1"
rel="self" />
</Email>
<EmailAddress>joesflowers@example.com</EmailAddress>
</ReplyToEmail>
</Campaign>
</content>
<source>
<id>http://api.constantcontact.com/ws/customers/joesflowers/campaigns</id>
<title type="text">Campaigns for customer: joesflowers</title>
<link href="campaigns" />
<link href="campaigns" rel="self" />
<author>
<name>joesflowers</name>
</author>
<updated>2009-10-19T19:36:12.622Z</updated>
</source>
</entry>

 

 

 

webservices