We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

400 Error on Campaign Setup

SOLVED
Go to solution
JimI
Participant

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>

1 ACCEPTED SOLUTION
bsoder
Employee

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
bsoder
Employee

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

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