Error 400: Invalid Content while creating Campaign

SOLVED
Go to solution
Regular Participant

Error 400: Invalid Content while creating Campaign

could you please help me where the error is

 

 

<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
    <link  href="/ws/customers/rakesh286@gmail.com/campaigns" rel="edit" />
    <id>http://api.constantcontact.com/ws/customers/rakesh286@gmail.com/campaigns</id>
    <title type="text">nwe campiagn</title>
    <updated>2013-04-04T14:21:06.407Z</updated>
    <author>
        <name>rakesh</name>
    </author>
    <content type="application/vnd.ctct+xml">
        <Campaign  xmlns="http://ws.constantcontact.com/ns/1.0/">
            <Name>rakeshcamp</Name>
            <Status>Draft</Status>
            <Date>2013-04-04T14:21:06.407Z</Date>
            <Subject>rakeshcam</Subject>
            <FromName>rakesh</FromName>
            <ViewAsWebpage>NO</ViewAsWebpage>
            <ViewAsWebpageLinkText />
            <ViewAsWebpageText />
            <PermissionReminder>NO</PermissionReminder>
            <PermissionReminderText />
            <GreetingSalutation>dear</GreetingSalutation>
            <GreetingName>FirstName</GreetingName>
            <GreetingString>rakesh</GreetingString>
            <OrganizationName>rakeshhouse</OrganizationName>
            <OrganizationAddress1>123</OrganizationAddress1>
            <OrganizationAddress2>456</OrganizationAddress2>
            <OrganizationAddress3>234</OrganizationAddress3>
            <OrganizationCity>hyd</OrganizationCity>
            <OrganizationState>AP</OrganizationState>
            <OrganizationInternationalState>in</OrganizationInternationalState>
            <OrganizationCountry>us</OrganizationCountry>
            <OrganizationPostalCode>500987</OrganizationPostalCode>
            <IncludeForwardEmail>NO</IncludeForwardEmail>
            <ForwardEmailLinkText />
            <IncludeSubscribeLink>NO</IncludeSubscribeLink>
            <SubscribeLinkText />
            <EmailContentFormat>HTML</EmailContentFormat>
            <EmailContent>&amp;lt;html&amp;gt;          &amp;lt;body&amp;gt;Hello!          &amp;lt;/body&amp;gt;        &amp;lt;/html&amp;gt;</EmailContent>
            <EmailTextContent>&amp;lt;Text&gt;hello&amp;lt;/Text&gt;</EmailTextContent>
            <StyleSheet />
            <ContactLists>
                <ContactList id="http://api.constantcontact.com/ws/customers/rakesh286@gmail.com/lists/1">
                    <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/rakesh286@gmail.com/lists/1" rel="self" />
                </ContactList>
            </ContactLists>
            <FromEmail>
                <Email id="http://api.constantcontact.com/ws/customers/rakesh286@gmail.com/settings/emailaddresses/1">
                    <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/rakesh286@gmail.com/settings/emailaddresses/1" rel="self" />
                </Email>
                <EmailAddress>rakesh286@gmail.com</EmailAddress>
            </FromEmail>
            <ReplyToEmail>
                <Email id="http://api.constantcontact.com/ws/customers/rakesh286@gmail.com/settings/emailaddresses/1">
                    <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/rakesh286@gmail.com/settings/emailaddresses/1" rel="self" />
                </Email>
                <EmailAddress>rakesh286@gmail.com</EmailAddress>
            </ReplyToEmail>
        </Campaign >
    </content>
    <source>
        <id>http://api.constantcontact.com/ws/customers/rakesh286@gmail.com/campaigns</id>
        <title type="text">nwe campiagn</title>
        <link  href="campaigns" />
        <link  href="campaigns" rel="self" />
        <author>
            <name>rakesh</name>
        </author>
        <updated>2013-04-04T14:21:06.407Z</updated>
    </source>
</entry>

 

 

thanks in advance

1 ACCEPTED SOLUTION

Sorry about that, I did have to change the EmailContent and EmailTextContent as follows:

 

<EmailContent>&lt;html&gt; &lt;body&gt;Hello! &lt;/body&gt; &lt;/html&gt;</EmailContent>
<EmailTextContent>text</EmailTextContent>

 

Best Regards,

Shannon W.

API Support Specialist

View solution in original post

4 REPLIES 4
Employee

Hi,

 

The error appears to have been with the contents of the EmailTextContent node.  If you replace the contents with something simple, like "Hi There", omitting the encoded <Text> tags, the payload should work.

 

Best Regards,

Shannon W.

API Support Specialist

Regular Participant

thanks for the reply Shannon

 

After replacping the EmailTextContent  Node still i am getting the error 400 Invaild Content

Sorry about that, I did have to change the EmailContent and EmailTextContent as follows:

 

<EmailContent>&lt;html&gt; &lt;body&gt;Hello! &lt;/body&gt; &lt;/html&gt;</EmailContent>
<EmailTextContent>text</EmailTextContent>

 

Best Regards,

Shannon W.

API Support Specialist

View solution in original post

Regular Participant

thanks for the reply Shannon

 

its working :) :)

Developer Portal

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

Visit Page