You can use campaigns collection list campaigns and create a new campaign, and use a specific campaign resource to modify or delete a campaign. To find out more about how to use the campaign collection and resource, refer to Managing Email Campaigns.
The campaign resource utilizes another resource that represents the user's email addresses, in order to specify "From Eamil" and "Reply To Email" fields in a campaign. To find out more about this resource, refer to Using Account Settings Email Addresses. To read up on technical reference for the resource, refer to Account Settings Email Address Reference.
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.
GET https://api.constantcontact.com/ws/customers/{user-name}/campaigns
For more detailed information about the URI, refer to the URI Format description.
For more information about listing campaigns, refer to Managing Email Campaigns.
<?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.
For more detailed descriptions of the XML elements, refer to the Campaign Elements Data section.
POST https://api.constantcontact.com/ws/customers/{user-name}/campaigns
For more detailed information about the URI, refer to the URI Format description.
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 <ConfirmOptin><a style="color:#0000ff;">confirm</a></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><html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:cctd="http://www.constantcontact.com/cctd"> <body><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.</CopyRight> <OpenTracking/> <!-- Do NOT delete previous line if you want to get statistics on the number of opened emails --> <CustomBlock name="letter.intro" title="Personalization"> <Greeting/> </CustomBlock> </body> </html></EmailContent> <EmailTextContent><Text>This is the text version.</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>
For more detailed descriptions of the XML elements, refer to the Campaign Elements Data section.
The campaign resource refers to individual campaigns under the campaigns collection. Each campaign is represented with an ID and resides under the campaigns collection in the URI. By performing GET on a specific campaign resource, you retrieve details of a particular campaign. By performing PUT on a specific campaign resource, you make updates to a particular campaign.
GET https://api.constantcontact.com/ws/customers/{user-name}/campaigns/{campaign-id}
For more detailed information about the URI, refer to the URI Format description.
To learn more about how to obtain a campaign's details, please refer to the Managing Email Campaigns.
<?xml version='1.0' encoding='UTF-8'?> <entry xmlns="http://www.w3.org/2005/Atom"> <link href="/ws/customers/joesflowers/campaigns/1100545398420" rel="edit" /> <id>http://api.constantcontact.com/ws/customers/joesflowers/campaigns/1100545398420</id> <title type="text">joesflowers custom campaign HTML</title> <updated>2009-10-01T18:42:56.939Z</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/1100545398420"> <Name>joesflowers custom campaign HTML</Name> <Status>Draft</Status> <Date>2009-10-01T18:42:56.939Z</Date> <LastEditDate>2009-10-01T18:43:40.656Z</LastEditDate> <Sent>0</Sent> <Opens>0</Opens> <Clicks>0</Clicks> <Bounces>0</Bounces> <Forwards>0</Forwards> <OptOuts>0</OptOuts> <SpamReports>0</SpamReports> <Subject>Enter email subject here</Subject> <FromName>joesflowers</FromName> <CampaignType>CUSTOM</CampaignType> <ViewAsWebpage>YES</ViewAsWebpage> <ViewAsWebpageLinkText>Click here</ViewAsWebpageLinkText> <ViewAsWebpageText>Having trouble viewing this email?</ViewAsWebpageText> <PermissionReminder>YES</PermissionReminder> <PermissionReminderText>You're receiving this email because of your relationship with Constant Contact. Please < ConfirmOptin><a style="color:#0000ff;">confirm</a></ConfirmOptin> your continued interest in receiving email from us.</PermissionReminderText> <GreetingSalutation>Dear</GreetingSalutation> <GreetingName>First_Name</GreetingName> <GreetingString>Greetings!</GreetingString> <OrganizationName>Constant Contact</OrganizationName> <OrganizationAddress1>1601 Trapelo Rd.</OrganizationAddress1> <OrganizationAddress2></OrganizationAddress2> <OrganizationAddress3></OrganizationAddress3> <OrganizationCity>Waltham</OrganizationCity> <OrganizationState>MA</OrganizationState> <OrganizationInternationalState></OrganizationInternationalState> <OrganizationCountry>us</OrganizationCountry> <IncludeForwardEmail>YES</IncludeForwardEmail> <ForwardEmailLinkText>Forward email</ForwardEmailLinkText> <IncludeSubscribeLink>YES</IncludeSubscribeLink> <SubscribeLinkText>Subscribe me!</SubscribeLinkText> <EmailContentFormat>HTML</EmailContentFormat> <EmailContent><!-- If your HTML code DOES include the html, head, and body tags, replace the entire code below with your custom HTML code. Please note, if you want to use the Constant Contact personalized greeting, make sure to add the <Greeting/> tag to your code. --> <html> <body> <Greeting /> <!-- If your HTML code DOES NOT include the html, head, and body tags, paste your custom HTML code between the START and END comments --> <!-- START --> <!-- END --> </body> </html></EmailContent> <EmailTextContent><Text> <Greeting /> </Text></EmailTextContent> <StyleSheet></StyleSheet> <ContactLists> <ContactList id="http://api.constantcontact.com/ws/customers/joesflowers/lists/2"> <link xmlns="http://www.w3.org/2005/Atom" href="http://api.constantcontact. com/ws/customers/joesflowers/lists/2" 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="http://api.constantcontact. com/ws/customers/joesflowers/settings/emailaddresses/1" rel="self" /> </Email> <EmailAddress>joesflowers@constantcontact.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="http://api.constantcontact. com/ws/customers/joesflowers/settings/emailaddresses/1" rel="self" /> </Email> <EmailAddress>joesflowers@constantcontact.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="http://api.constantcontact.com/ws/customers/joesflowers/campaigns" /> <link href="http://api.constantcontact.com/ws/customers/joesflowers/campaigns" rel="self" /> <author> <name>joesflowers</name> </author> <updated>2009-10-01T18:43:40.731Z</updated> </source> </entry>
For more detailed descriptions of the XML elements, refer to the Campaign Elements Data section.
PUT https://api.constantcontact.com/ws/customers/{user-name}/campaigns/{campaign-id}
For more detailed information about the URI, refer to the URI Format description.
To learn more about how to modify a campaign, please refer to the Managing Email Campaigns.
The XML body used for PUT should look the same as the response you get from a GET operation. The easiest way to make changes to a campaign is to retrieve its details through a GET operation, and modify only the elements you want and posting the changes using the PUT operation.
DELETE https://api.constantcontact.com/ws/customers/{user-name}/campaigns/{campaign-id}
For more detailed information about the URI, refer to the URI Format description.
To learn more about how to delete a campaign, please refer to the Managing Email Campaigns.
| URI Component | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| user-name |
The account owner's Constant Contact user name. |
||||||||||
|
campaigns |
To find particular campaigns, query the collection by adding one or more query parameters to the collection's URI:
Below are the choices of status for query:
|
||||||||||
| campaign-id |
Represents an individual Campaign entry. It can be obtained from the Location header after creating a new |
| Property Name | Allowed Values |
Editable? |
Description |
|---|---|---|---|
|
Name |
|
Yes |
Name for the Campaign |
|
Date |
|
No |
|
|
LastEditDate |
|
No |
Last date/time the Campaign was edited |
|
LastRunDate |
|
No |
Last date/time the Campaign ran |
|
NextRunDate |
|
No |
The next date/time the Campaign will run |
|
Status |
Draft, Running, Scheduled, Archive Pending, Archived, Close Pending, Closed, Sent |
No |
Status of the Campaign |
|
Sent |
|
No |
Number of emails sent for the campaign |
|
Opens |
|
No |
Number of unique opens |
|
Clicks |
|
No |
Number of unique clicks |
|
Bounces |
|
No |
Number of bounced emails |
|
Forwards |
|
No |
Number of times the campaign was forwarded (using the Forward link if included) |
|
OptOuts |
|
No |
Number of opt outs from the campaign |
|
Subject |
|
Yes |
Subject line for the email |
|
FromName |
|
Yes |
The name that is displayed in the from box in the recipients email client |
|
FromEmail |
|
Yes |
Email address entry represents From address shows the address that the email originated from |
|
ReplyToEmail |
|
Yes |
Email address entry represents the field used by an email client's reply function |
|
CampaignType |
STOCK/CUSTOM | No | Describes whether the email campaign is based on a template (STOCK) or on HTML/XHTML custom code (CUSTOM). |
|
ViewAsWebpage |
YES/NO |
Yes |
This allows contacts who cannot view images in their email program to open your email in a browser window. |
|
ViewAsWebpageLinkText |
|
Yes |
The text for the actual link in the View As Webpage link in the email |
|
ViewAsWebageText |
|
Yes |
The text displayed together with the LinkText at the top of your email |
|
PermissionReminder |
YES/NO |
Yes |
Whether to show a permission reminder at the top of the email allowing recipients to confirm their opt in. FAQ |
|
GreetingSalutation |
|
Yes |
Describes the chosen salutation to be used at the opening of the email (e.g. Dear) |
|
GreetingName |
FirstName, LastName, FirstAndLastName, None |
Yes |
Indicates if the email greeting should include just the recipient's FirstName, just the LastName, Both, or neither and use GreetingString instead. |
|
GreetingString |
|
Yes |
Allows you to specify the full greeting string instead of the components of the previous two properties. If GreetingName and GreetingString are populated, they will be used instead of GreetingString. |
|
OrganizationName |
|
Yes |
Name of organization for use in the email footer |
|
OrganizationAddress1 |
|
Yes |
Line 1 of the organization address for use in the email footer |
|
OrganizationAddress2 |
|
Yes |
Line 2 of the organization address for use in the email footer |
|
OrganizationAddress3 |
|
Yes |
Line 3 of the organization address for use in the email footer |
|
OrganizationCity |
|
Yes |
City of the organization for use in the email footer |
|
OrganizationState |
|
Yes |
State of the organization for use in the email footer |
|
OrganizationInternationalState |
|
Yes |
International "State" if outside the US for use in the email footer |
|
OrganizationPostalCode |
|
Yes |
PostalCode/Zipcode of the organization for use in the email footer |
|
OrganizationCountry |
|
Yes |
Country of the organization for use in the email footer |
|
IncludeForwardEmail |
YES/NO |
Yes |
Boolean type property that indicates if the email should include a Forward This Email link |
|
ForwardEmailLinkText |
|
Yes |
If IncludeForwardEmail property is set to YES, then this property should be specified and will appear in the email as the text of the link |
|
IncludeSubscribeLink |
YES/NO |
Yes |
Boolean type property that indicates if the email should include a Subscribe link |
|
SubscribeLinkText |
|
Yes |
If IncludeSubscribeLink property is set to YES, then this property should be specified and will appear in the email as the text of the link |
|
EmailContentFormat |
HTML/XHTML | Yes | Describes whether email content is based on HTML or XHTML. |
|
EmailContent |
|
Yes |
The full HTML/XHTML content of the email |
|
EmailTextContent |
|
Yes |
The text version of the email content. Will be used for email clients that do not have HTML email capability or have it disabled. |
|
StyleSheet |
Yes | The stylesheet elements that are used for the email content. | |
|
URLS |
|
No |
Collection of URL entries that were included in this email for click tracking purposes |
|
ContactLists |
|
No |
Collection of ContactList entries that are associated with this email Campaign |
Recent comments
1 day 15 hours ago
1 day 16 hours ago
1 day 17 hours ago
1 day 18 hours ago
1 day 20 hours ago
1 day 20 hours ago
1 day 20 hours ago
1 day 20 hours ago
1 day 20 hours ago
1 day 20 hours ago