cancel
Showing results for 
Search instead for 
Did you mean: 

An Error Occurred. The campaign could not be added.

Occasional Contributor

An Error Occurred. The campaign could not be added.

I've look over this create Campaign xml for hours trying to find out what I may be leaving out or missing.  I don't think it's the EmailContent node not being well formed or html encoded cause i replace with some simple Hello World html page.  Here is my xml string I'm sending:

 

<?xml version="1.0" encoding="UTF-8"?><entry xmlns="http://www.w3.org/2005/Atom">    <link href="/ws/customers/myusername/campaigns" rel="edit"/>    <id>http://api.constantcontact.com/ws/customers/myusername/campaigns</id>    <title type="text">Flower Deal get 3 for the price of 1</title>    <updated>2011-07-05T15:54:33+01: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/myusername/campaigns/1100546096289">            <Name>Flower Deal get 3 for the price of 1</Name>            <Status>Draft</Status>            <Date>2011-07-05T15:54:33 01:00</Date>            <Subject>A New Deal from My Company</Subject>            <FromName>My Company</FromName>            <ViewAsWebpage>YES</ViewAsWebpage>            <ViewAsWebpageLinkText>http://My Company/index.php/deal/24-Flower-Deal-get-3-for-the-price-of-1</ViewAsWebpageLinkText>            <ViewAsWebpageText>Today's Deal!</ViewAsWebpageText>            <PermissionReminder>NO</PermissionReminder>            <PermissionReminderText></PermissionReminderText>            <GreetingSalutation></GreetingSalutation>            <GreetingName>NONE</GreetingName>            <GreetingString></GreetingString>            <OrganizationName>My Company</OrganizationName>            <OrganizationAddress1>221 My Avenue</OrganizationAddress1>            <OrganizationAddress2></OrganizationAddress2>            <OrganizationAddress3></OrganizationAddress3>            <OrganizationCity>City</OrganizationCity>            <OrganizationState>IN</OrganizationState>            <OrganizationInternationalState></OrganizationInternationalState>            <OrganizationCountry>us</OrganizationCountry>            <OrganizationPostalCode>55555</OrganizationPostalCode>            <IncludeForwardEmail>NO</IncludeForwardEmail>            <ForwardEmailLinkText></ForwardEmailLinkText>            <IncludeSubscribeLink>NO</IncludeSubscribeLink>            <SubscribeLinkText></SubscribeLinkText>            <EmailContentFormat>HTML</EmailContentFormat>            <EmailContent>&lt;html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"xmlns:cctd="http://www.constantcontact.com/cctd"&gt;&lt;body&gt;&lt;p&gt;Hello World!&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</EmailContent>            <EmailTextContent>&lt;Text&gt;TestText&lt;/Text&gt;</EmailTextContent>            <StyleSheet></StyleSheet>            <ContactLists>                <ContactList id="http://api.constantCampaign.com/ws/customers/myusername/campaigns/4">                    <link xmlns="http://www.w3.org/2005/Atom" href="http://api.constantCampaign.com/ws/customers/myusername/campaigns/4" rel="self"/>                </ContactList>            </ContactLists>            <FromEmail>                <Email id="http://api.constantcontact.com/ws/customers/myusername/settings/emailaddresses/3">                    <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/myusername/settings/emailaddresses/3" rel="self"/>                </Email>                <EmailAddress>deal@MyCompany.com</EmailAddress>            </FromEmail>            <ReplyToEmail>                <Email id="http://api.constantcontact.com/ws/customers/myusername/settings/emailaddresses/3">                    <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/myusername/settings/emailaddresses/3" rel="self"/>                </Email>                <EmailAddress>deal@MyCompany.com</EmailAddress>            </ReplyToEmail>        </Campaign>    </content>    <source>        <id>http://api.constantcontact.com/ws/customers/myusername/campaigns</id>        <title type="text">Campaigns for customer: myusername</title>        <link href="campaigns"/>        <link href="campaigns" rel="self"/>        <author>            <name>myusername</name>        </author>        <updated>2011-07-05T15:54:33+01:00</updated>    </source></entry>

8 REPLIES 8
Highlighted
CTCT Employee

Re: An Error Occurred. The campaign could not be added.

Hello,

 

I believe the issue you are having is that the ViewAsAWebPageLinkText is too long (it cannot be longer than 50 characters).  The link text is not meant to be a link to a web page version of the email, that is generated automatically by our system.  The ViewAsAWebPageText is the text before the link, and the ViewAsAWebPageLinkText is the text that is in the link.  So you would have "Having trouble viewing this? Click Here!", where Having trouble viewing this would be the ViewAsAWebPageText and Click Here! would be ViewAsAWebPageLinkText .

 

If you have any questions please let me know.

 

Regards,

Benjamin Soder
NOC Analyst
Constant Contact
Occasional Contributor

Re: An Error Occurred. The campaign could not be added.

Thanks for the reply Benjamin.  Made change to ViewAsWebPageLinkText:


<ViewAsWebpage>YES</ViewAsWebpage>

<ViewAsWebpageLinkText>Click Here</ViewAsWebpageLinkText>

<ViewAsWebpageText>Having trouble viewing this</ViewAsWebpageText> 

 

However, I'm still getting the "An Error Occurred. The campaign could not be added." response. 

 

Thanks for all your help, here is my latest XML string with the changes, again I've changed my username.

 

<?xml version="1.0" encoding="UTF-8"?> <entry xmlns="http://www.w3.org/2005/Atom">    <link href="/ws/customers/myusername/campaigns" rel="edit"/>    <id>http://api.constantcontact.com/ws/customers/myusername/campaigns</id>    <title type="text">Flower Deal get 3 for the price of 1</title>    <updated>2011-07-06T10:45:00+01: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/myusername/campaigns/1100546096289">            <Name>Flower Deal get 3 for the price of 1</Name>            <Status>Draft</Status>            <Date>2011-07-06T10:45:00 01:00</Date>            <Subject>A New Deal from MySite.com</Subject>            <FromName>MySite.com</FromName>            <ViewAsWebpage>YES</ViewAsWebpage>            <ViewAsWebpageLinkText>Click Here</ViewAsWebpageLinkText>            <ViewAsWebpageText>Having trouble viewing this</ViewAsWebpageText>            <PermissionReminder>NO</PermissionReminder>            <PermissionReminderText></PermissionReminderText>            <GreetingSalutation></GreetingSalutation>            <GreetingName>NONE</GreetingName>            <GreetingString></GreetingString>            <OrganizationName>MySite.com</OrganizationName>            <OrganizationAddress1>221 St. Louis Avenue</OrganizationAddress1>            <OrganizationAddress2></OrganizationAddress2>            <OrganizationAddress3></OrganizationAddress3>            <OrganizationCity>Seymour</OrganizationCity>            <OrganizationState>IN</OrganizationState>            <OrganizationInternationalState></OrganizationInternationalState>            <OrganizationCountry>us</OrganizationCountry>            <OrganizationPostalCode>47274</OrganizationPostalCode>            <IncludeForwardEmail>NO</IncludeForwardEmail>            <ForwardEmailLinkText></ForwardEmailLinkText>            <IncludeSubscribeLink>NO</IncludeSubscribeLink>            <SubscribeLinkText></SubscribeLinkText>            <EmailContentFormat>HTML</EmailContentFormat>            <EmailContent>&lt;html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"xmlns:cctd="http://www.constantcontact.com/cctd"&gt;&lt;body&gt;&lt;p&gt;Hello World!&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</EmailContent>            <EmailTextContent>&lt;Text&gt;TestText&lt;/Text&gt;</EmailTextContent>            <StyleSheet></StyleSheet>            <ContactLists>                <ContactList id="http://api.constantCampaign.com/ws/customers/myusername/campaigns/4">                    <link xmlns="http://www.w3.org/2005/Atom" href="http://api.constantCampaign.com/ws/customers/myusername/campaigns/4" rel="self"/>                </ContactList>            </ContactLists>            <FromEmail>                <Email id="http://api.constantcontact.com/ws/customers/myusername/settings/emailaddresses/3">                    <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/myusername/settings/emailaddresses/3" rel="self"/>                </Email>                <EmailAddress>deal@myusername.com</EmailAddress>            </FromEmail>            <ReplyToEmail>                <Email id="http://api.constantcontact.com/ws/customers/myusername/settings/emailaddresses/3">                    <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/myusername/settings/emailaddresses/3" rel="self"/>                </Email>                <EmailAddress>deal@myusername.com</EmailAddress>            </ReplyToEmail>        </Campaign>    </content>    <source>        <id>http://api.constantcontact.com/ws/customers/myusername/campaigns</id>        <title type="text">Campaigns for customer: myusername</title>        <link href="campaigns"/>        <link href="campaigns" rel="self"/>        <author>            <name>myusername</name>        </author>        <updated>2011-07-06T10:45:00+01:00</updated>    </source></entry>

CTCT Employee

Re: An Error Occurred. The campaign could not be added.

Hello,

 

The XML you provided definitely works on my end.  Typically the reason that it will not post is due to the from and reply to email address sections not being verified email addresses.  Another reason could be that the name of the email is already being used by another email.  Are you getting a response code as well as an error code?  This could also be helpful to see what the response code is, if it is a 400, or 409.

 

Thanks,

Benjamin Soder
NOC Analyst
Constant Contact
Occasional Contributor

Re: An Error Occurred. The campaign could not be added.

I'm getting "The requested URL returned error: 400The requested URL returned error: 404"

CTCT Employee

Re: An Error Occurred. The campaign could not be added.

Hello,

 

What URI are you posting that XML to?  It should be a POST to https://api.constantcontact.com/ws/customers/USERNAME/campaigns

 

Please note the https and not http.

 

Regards,

Benjamin Soder
NOC Analyst
Constant Contact
Occasional Contributor

Re: An Error Occurred. The campaign could not be added.

That is the URI I'm using.  I've been using the PHP cc_class file already for creating subscribers and that works great.  Now I'm trying to also us the CC_Campaign class to manage campaigns and it's giving me the errors when trying to addCampaign.  

First I use validateCampaign to make sure I have the right fields and thats successful.

Then I use createCampaignXML to create the XML string to pass to addCampaign.

 

I turned the $curl_debug on or true and get the "The requested URL returned error: 400The requested URL returned error: 404" error when passing the XML string I posted to addCampaign.

 

Thanks again for all your help!

CTCT Employee

Re: An Error Occurred. The campaign could not be added.

When I post the XML it is working fine on my end, is it possible for you to send me the code that you are using, here?  I can then take a look and see what is going wrong.

 

Regards,

Benjamin Soder
NOC Analyst
Constant Contact
Occasional Contributor

Re: An Error Occurred. The campaign could not be added.

Thanks, just sent you the email.