Error 400: Invalid Content.(Create Campaign)

ArchanaS5
Participant

Error 400: Invalid Content.(Create Campaign)

Hello,

 

Please help me with the XML code. While adding a campaign I am getting Error 400.

 

?xml version="1.0" encoding="UTF-8" ?
  <link href="/ws/customers/archana@rapidsoftsystems.com/campaigns" rel="edit" />
  <title type="text">API Test Email</title>
  <updated>2012-02-27T07:46:03Z</updated>
- <author>
  <name>Constant Contact</name>
  </author>
- <content type="application/vnd.ctct+xml">
  <Name>API Test Email</Name>
  <Status>Draft</Status>
  <Date>2012-02-27T07:46:03Z</Date>
  <Subject>Enter email subject here</Subject>
  <FromName>archana@rapidsoftsystems.com</FromName>
  <ViewAsWebpage>NO</ViewAsWebpage>
  <ViewAsWebpageLinkText />
  <ViewAsWebpageText />
  <PermissionReminder>NO</PermissionReminder>
  <PermissionReminderText />
  <GreetingSalutation>Dear</GreetingSalutation>
  <GreetingName>None</GreetingName>
  <GreetingString>hello</GreetingString>
  <OrganizationName>Rapidsoftsystems</OrganizationName>
  <OrganizationAddress1>Secotr 8</OrganizationAddress1>
  <OrganizationAddress2 />
  <OrganizationAddress3 />
  <OrganizationCity>Noida</OrganizationCity>
  <OrganizationState />
  <OrganizationInternationalState>Uttar Pradesh</OrganizationInternationalState>
  <OrganizationCountry>IN</OrganizationCountry>
  <OrganizationPostalCode>201301</OrganizationPostalCode>
  <IncludeForwardEmail>NO</IncludeForwardEmail>
  <ForwardEmailLinkText />
  <IncludeSubscribeLink>NO</IncludeSubscribeLink>
  <SubscribeLinkText />
  <EmailContentFormat>HTML</EmailContentFormat>
  <EmailContent><p>hello</p></EmailContent>
  <EmailTextContent><Text>hello</Text></EmailTextContent>
  <StyleSheet />
- <ContactLists>
  <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/archana%40rapidsoftsystems.com/lists/2" rel="self" />
  </ContactList>
  </ContactLists>
- <FromEmail>
  <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/archana@rapidsoftsystems.com/settings/emailaddresses/1" rel="self" />
  </Email>
  <EmailAddress>archana@rapidsoftsystems.com</EmailAddress>
  </FromEmail>
- <ReplyToEmail>
  <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/archana@rapidsoftsystems.com/settings/emailaddresses/1" rel="self" />
  </Email>
  <EmailAddress>archana@rapidsoftsystems.com</EmailAddress>
  </ReplyToEmail>
  </Campaign>
  </content>
- <source>
  <title type="text">Campaigns for customer: archana@rapidsoftsystems.com</title>
  <link href="campaigns" />
  <link href="campaigns" rel="self" />
- <author>
  <name>archana@rapidsoftsystems.com</name>
  </author>
  <updated>2012-02-27T07:46:03Z</updated>
  </source>
  </entry>

 

 

Thanks & Regards,
Archana Singh

[*Note from a CTCT Community Admin: I removed the beginning and ending brackets from the "?xml version="1.0" encoding="UTF-8"?" line in your post above because that line breaks the "Developer Support" tab in our CTCT "Labs JMML Q&A" Facebook app (apparently, the app is trying to render that line as is, which wouldn't be acceptable in the middle of a page).]
1 REPLY 1
Nick_G
Moderator

Hi Archana,

 

It looks like the problem is coming from your EmailContent and EmailTextContent fields. Because of the format of the XML, any HTML tags need to start off with &lt; instead of the actual < symbol. Also, the EmailContent needs to be in a valid HTML format, so be sure to add html and body tags. So, those two tags should look like this:

 

<EmailContent>&lt;html>&lt;body>&lt;p>hello&lt;/p>&lt;/body>&lt;/html></EmailContent>
<EmailTextContent>&lt;Text>hello&lt;/Text></EmailTextContent>

 Let me know if you have any other problems. Thanks!

Nick Galbraith
Support Engineer
Developer Portal

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

Visit Page