The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

400 Error on Campaign Setup

SOLVED
Go to solution
Highlighted
Occasional Organizer

400 Error on Campaign Setup

We are receiving a 400 error when trying to set up a new campaign and have tried both the PHP Class and PHP Wrapper with the same results.  Below is an example XML that is being sent.  The XTHML has been left to shorten this post out but I can copy and past it into the online composer and it validates just fine.  Thanks for the help in advance.

 

<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
  <link href="/ws/customers/userName/campaigns" rel="edit"/>
  <id>http://api.constantcontact.com/ws/customers/userName/campaigns</id>
  <title type="text">Campaign Name with , and / - 20110530</title>
  <updated>2011-05-31T14:28:59-05:00</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/userName/campaigns/1100546096289">
      <Name>Campaign Name with , and / - 20110530</Name>
      <Status>draft</Status>
      <Date>2011-05-31T14:28:59-05:00</Date>
      <Subject>Email Subject</Subject>
      <FromName>FromName</FromName>
      <ViewAsWebpage/>
      <ViewAsWebpageLinkText/>
      <ViewAsWebpageText/>
      <PermissionReminder/>
      <PermissionReminderText/>
      <GreetingSalutation/>
      <GreetingName>NONE</GreetingName>
      <GreetingString/>
      <OrganizationName>Company Name</OrganizationName>
      <OrganizationAddress1>Address</OrganizationAddress1>
      <OrganizationAddress2/>
      <OrganizationAddress3/>
      <OrganizationCity>City</OrganizationCity>
      <OrganizationState>TX</OrganizationState>
      <OrganizationInternationalState/>
      <OrganizationCountry>US</OrganizationCountry>
      <OrganizationPostalCode>76092</OrganizationPostalCode>
      <IncludeForwardEmail>YES</IncludeForwardEmail>
      <ForwardEmailLinkText>Forward Email</ForwardEmailLinkText>
      <IncludeSubscribeLink>NO</IncludeSubscribeLink>
      <SubscribeLinkText/>
      <EmailContentFormat>XHTML</EmailContentFormat>
      <EmailContent>xhtml here...</EmailContent>
      <EmailTextContent>&lt;Text&gt;text here...&lt;/Text&gt;</EmailTextContent>
      <StyleSheet/>
      <ContactLists>
        <ContactList id="http://api.constantcontact.com/ws/customers/userName/lists/21">
          <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/userName/lists/21" rel="self"/>
        </ContactList>
      </ContactLists>
      <FromEmail>
        <Email id="http://api.constantcontact.com/ws/customers/userName/settings/emailaddresses/2">
          <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/userName/settings/emailaddresses/2" rel="self"/>
        </Email>
        <EmailAddress>help@asdf.com</EmailAddress>
      </FromEmail>
      <ReplyToEmail>
        <Email id="http://api.constantcontact.com/ws/customers/userName/settings/emailaddresses/2">
          <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/userName/settings/emailaddresses/2" rel="self"/>
        </Email>
        <EmailAddress>help@asdf.com</EmailAddress>
      </ReplyToEmail>
    </Campaign>
  </content>
  <source>
    <id>http://api.constantcontact.com/ws/customers/userName/campaigns</id>
    <title type="text">Campaigns for customer: userName</title>
    <link href="campaigns"/>
    <link href="campaigns" rel="self"/>
    <author>
      <name>userName</name>
    </author>
    <updated>2011-05-31T14:28:59-05:00</updated>
  </source>
</entry>

Tags (4)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Employee

Re: 400 Error on Campaign Setup

Hello,

 

I believe the main issue you are having is with the ViewAsWebpage and PermissionReminder nodes.  Instead of having them empty, you need to put a No inside of them if you are not including a view as a webpage link or permission reminder.  When I did this, and added correct XHTML, it posted successfully.

 

If you have any quesitons please let me know.

Benjamin Soder
NOC Analyst
Constant Contact

View solution in original post

2 REPLIES 2
Highlighted
Employee

Re: 400 Error on Campaign Setup

Hello,

 

I believe the main issue you are having is with the ViewAsWebpage and PermissionReminder nodes.  Instead of having them empty, you need to put a No inside of them if you are not including a view as a webpage link or permission reminder.  When I did this, and added correct XHTML, it posted successfully.

 

If you have any quesitons please let me know.

Benjamin Soder
NOC Analyst
Constant Contact

View solution in original post

Highlighted
Occasional Organizer

Re: 400 Error on Campaign Setup

Thanks, that seemed to do the trick for me as well.  So to update everyone on the forum, you must include a value of NO in <ViewAsWebpage>, <PermissionReminder>, and <IncludeForwardEmail> even if you do not use these options.

Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured