Reply
Occasional Contributor
HemanthK6
Posts: 2
Registered: ‎05-18-2012

problem with creating a campaigns in drupal

[ Edited ]

Hi all,

 

I useing the below restapi to connect constant contact. When I'm running the below api, I'm getting "Error 400: Invalid Content". Can you please provide me the solution to connect to constant contact.

 

<entry xmlns="http://www.w3.org/2005/Atom">
  <link href="/ws/customers/sl_hemanthkumar/campaigns" rel="edit" />
  <id>http://api.constantcontact.com/ws/customers/sl_hemanthkumar/campaigns</id>
  <title type="text">Test Email1337854673</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/sl_hemanthkumar/campaigns/1100546096289">
      <Name>Test Email1337854673</Name>
      <Status>Draft</Status>
      <Date>2009-10-19T18:34:53.105Z</Date>
<Subject>Test</Subject>
<FromName>qwa@qualcomm.com</FromName>
<ViewAsWebpage>NO</ViewAsWebpage>
<ViewAsWebpageLinkText></ViewAsWebpageLinkText>
<ViewAsWebpageText></ViewAsWebpageText>
<PermissionReminder>NO</PermissionReminder>
<PermissionReminderText></PermissionReminderText>
<GreetingSalutation>Dear</GreetingSalutation>
<GreetingName>FirstName</GreetingName>
<GreetingString>Greetings!</GreetingString>
<OrganizationName>TCS</OrganizationName>
<OrganizationAddress1>#1</OrganizationAddress1>
<OrganizationAddress2>Test</OrganizationAddress2>
<OrganizationAddress3>Test</OrganizationAddress3>
<OrganizationCity>bangalore</OrganizationCity>
<OrganizationState>VT</OrganizationState>
<OrganizationInternationalState></OrganizationInternationalState>
<OrganizationCountry>us</OrganizationCountry>
<OrganizationPostalCode>23534</OrganizationPostalCode>
<IncludeForwardEmail>NO</IncludeForwardEmail>
<ForwardEmailLinkText></ForwardEmailLinkText>
<IncludeSubscribeLink>NO</IncludeSubscribeLink>
<SubscribeLinkText></SubscribeLinkText>
<EmailContentFormat>HTML</EmailContentFormat>
<EmailContent>Test email from constant contact module</EmailContent>
<EmailTextContent>&lt;Text>hello&lt;/Text></EmailTextContent>
<ContactLists>
                <ContactList id="http://api.constantcontact.com/ws/customers/sl_hemanthkumar/lists/1">
                <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/sl_hemanthkumar/lists/1" rel="self" />
                </ContactList>
              </ContactLists>
            <FromEmail>
            <Email id="http://api.constantcontact.com/ws/customers/sl_hemanthkumar/settings/emailaddresses/1">
            <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/sl_hemanthkumar/settings/emailaddresses/1" rel="self" />
            </Email>
            <EmailAddress>kumar.hemanth@tcs.com</EmailAddress>
            </FromEmail>
            <ReplyToEmail>
            <Email id="http://api.constantcontact.com/ws/customers/sl_hemanthkumar/settings/emailaddresses/1">
            <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/sl_hemanthkumar/settings/emailaddresses/1" rel="self" />
            </Email>
            <EmailAddress>kumar.hemanth@tcs.com</EmailAddress>
            </ReplyToEmail>
           
    </Campaign>
    </content>
    <source>
        <id>http://api.constantcontact.com/ws/customers/sl_hemanthkumar/campaigns</id>
        <title type="text">Campaigns for customer: sl_hemanthkumar</title>
        <link href="campaigns" />
        <link href="campaigns" rel="self" />
        <author>
            <name>sl_hemanthkumar</name>
        </author>
        <updated>2009-10-19T19:36:12.622Z</updated>
    </source>
</entry>

 

DaveBerard
Posts: 1,648
Topics: 7
Kudos: 62
Solutions: 61
Registered: ‎06-19-2008

Re: problem with creating a campaigns in drupal

From the XML you posted, there is definitely a node that would cause 400 errors.  400 Bad Request errors indicate that there is a problem with the XML content you are sending over.  The problem I see immediately is:

 

<EmailContent>HTML</EmailContent>

 

That node must be a fully formed, valid, XML encoded HTML document.  The simplist HTML document you can have would look like this:

 

<EmailContent>&lt;html>&lt;body>Some body&lt;/body>&lt;/html></EmailContent>

 

Otherwise, you would get a 400: Invalid Content error and the body of the error message we return would indicate that your <EmailContent> node must be well formed HTML.

 

 

Dave Berard
Senior Product Manager, Constant Contact