webservices

Campaign Resource

by Administrator on ‎03-25-2011 10:08 AM

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/{campaign-id}

  

To learn more about how to obtain a campaign's details, please refer to the Obtaining a Campaign's Information.

 

Response Format

 

 

<?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>
      <SharePageURL> http://myemail.constantcontact.com/Learn-more-about-me.html?soid=xxxxxx&amp;aid=aknBCDE</SharePageURL>
      <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 &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>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>
      <ArchiveStatus>Published</ArchiveStatus>
      <ArchiveURL>http://archive.constantcontact.com/fs048/1100545398420/archive/1100552358978.html </ArchiveURL>
      <EmailContentFormat>HTML</EmailContentFormat>
      <EmailContent>&lt;!-- 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 &lt;Greeting/> tag to your code. -->

&lt;html>
&lt;body>
&lt;Greeting />
&lt;!-- If your HTML code DOES NOT include the html, head, and body tags,
paste your custom HTML code between the START and END comments  -->
&lt;!--    START    -->


&lt;!--     END     -->
&lt;/body>
&lt;/html></EmailContent>
      <EmailTextContent>&lt;Text>
&lt;Greeting />
&lt;/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.

 

Updating a Campaign Request Format

 

 

PUT https://api.constantcontact.com/ws/customers/{user-name}/campaigns/{campaign-id}

 

To learn more about how to modify a campaign, please refer to Updating a Campaign.

 

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.

 

 

URI Format

 

URI ComponentDescription
user-name

The account owner's Constant Contact user name.
Value must be in lower case.

campaigns

To find particular campaigns, query the collection by adding one or more query parameters to the collection's URI:

campaigns?status=SENT

Below are the choices of status for query:

Status Description
SENT All campaigns that have been sent and not currently scheduled for resend
SCHEDULED All campaigns that are currently scheduled to be sent some time in the future
DRAFT All campaigns that have not yet been scheduled for delivery
RUNNING All campaigns that are currently being processed and delivered

 

campaign-id

Represents an individual Campaign entry. 

It can be obtained from the Location header after creating a new <entry> or from <link> element that has in the rel="edit" attribute in an existing <entry> of Campaigns collection.

A specific campaign's results can be manually re-calculated by using refresh paramter:

{campaign-id}?refresh=true

 

Campaign Data Elements

 

Property NameAllowed 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

SharePageURL   No URL for the hosted web page version of the email campaign.  This hosted version is created for, and used by, the SocialShare (Tweet and Share) feature in the Constant Contact scheduling flow.  

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

PermissionReminderText

 

Yes

Text to be displayed if PermissionReminder is set to Yes. Should be left blank if PermissionReminder is set to No.

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

ArchiveStatus

Pending

Published

No

Describes the status of the archived page.

Pending: Campaign is being archived

Published: Campaign archive page is available

ArchiveURL   No URL for the archived campaign page

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

 

Yes

Collection of ContactList entries that are associated with this email Campaign