Some of our customers are experiencing difficulty logging in. We are aware of this issue and are working to resolve it as quickly as we can.

Error 400 when creating Campaign

proimaging
Regular Participant

Error 400 when creating Campaign

I have an application that I created and tested to send e-mails.  It worked when created and we haven't made any changes in months.  I've recently tried using it and now I'm getting an Bad Request error 400, Invalid or Missing.

 

I can't figure out what is wrong with the XHTML that is causing the problem.  Has something changed in the API that there is additional information needed in the XML?

 

Here is the xml that is returned:

http://api.constantcontact.com/ws/customers/CLIENTNAME/campaigns/1109081646893 2011-01-06T20:23:55.609Z Testing:2/28/2013 11:58:32 AM Draft 2011-01-06T20:23:55.609Z 0 0 0 0 0 0 0 Testing Client Name CUSTOM YES Click here Having trouble viewing this email? YES You're receiving this email because of your relationship with XXX Please <ConfirmOptin><a style="color:#0000ff;">confirm</a></ConfirmOptin> your continued interest in receiving email from us. To ensure that you continue to receive emails from us, add <Property name="ACCOUNT.SIGNATUREEMAIL"/> to your address book today. Dear FirstName XX XXX XXX FL us 99999 YES Forward email YES Subscribe me! XHTML <html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:cctd="http://www.constantcontact.com/cctd"> <body bgcolor="#336699" align="center" valign="middle"><CopyRight>Copyright (c) 1996-2011 Constant Contact. All rights reserved. Except as permitted under a separate written agreement with Constant Contact, neither the Constant Contact software, nor any content that appears on any Constant Contact site, including but not limited to, web pages, newsletters, or templates may be reproduced, republished, repurposed, or distributed without the prior written permission of Constant Contact. For inquiries regarding reproduction or distribution of any Constant Contact material, please contact legal@constantcontact.com.</CopyRight> <OpenTracking/> <!-- Do NOT delete previous line if you want to get statistics on the number of opened emails --> <center><div class="containerindex"> <center><div class="header"><img src="http://proimaging.ws/images/header.jpg" /></div></center> this is a test</body></html> .copyright{width: 900px;height: 125px;color: #FFFFFF;text-align: left;margin-left: auto;margin-right: auto;margin-top: 0px;position: relative;top: 0px;} .containerindex{width: 900px;background: #FFFFFF;text-align: left;margin-left: auto;margin-right: auto;margin-top: 0px;position: relative;top: 0px;} .header {position: absolute;width: 900px;height: 116px;background: #336699;top: 0px;} .main {width: 900px;background: #999999;position: absolute;top: 214px;padding: 10px; height:250px;} .footer {width: 900px;height: 70px;background: #444444;margin-left: auto;margin-right: auto;position: relative;} .footerleft {width: 450px;background: #444444;text-align: left;position: absolute;left: 10px;top: 10px;} .footerright {width: 450px;background: #444444;text-align: right;position: absolute;right: 10px;top: 10px;} .footnav { width: 900px;height: 20px;background: #000000;margin-left: auto;margin-right: auto;position: relative;} .fnavleft {width: 450px;background: #000000;text-align: left;left: 10px;position: absolute;} .fnavright { width: 450px;background: #000000;text-align: right;right: 10px;position: absolute;} .addresstext { font-family:Verdana, Geneva, sans-serif; font-size: 12px; line-height: 16px; font-weight: normal; color: #ffffff; text-decoration:none;} .footertext { font-family: Verdana, Geneva, sans-serif; font-size: 10px; line-height: 16px; font-weight: normal; color: #ffffff; text-decoration:none;} .maintext { font-family: Verdana, Geneva, sans-serif; font-size: 12px; line-height: 16px; font-weight: normal; color: #000000; text-decoration:none;} .email {font-family: Verdana, Geneva, sans-serif; font-size: 12px; line-height: 16px; font-weight: bold; color: #ffffff; text-decoration:none;} .casetitle { font-family: Verdana, Geneva, sans-serif; font-size: 12px; line-height: 16px; font-weight: bold; color: #ffffff; text-decoration:none;} .link { font-family: Verdana, Geneva, sans-serif; font-size: 12px; line-height: 16px; font-weight: bold; color: #ffffff; text-decoration:none;} info@proimaging.ws info@domain.com

5 REPLIES 5
Shannon_W
Employee

Hi,

 

It looks like something stripped out the actual XML you're sending to us before you pasted it here.  Could you paste us the full XML payload you send to us?  It should look like the XML on this page if you're trying to create a new email campaign through the API.

 

Best Regards,

Shannon W.

API Support Specialist

proimaging
Regular Participant

<entry xmlns="http://www.w3.org/2005/Atom">
	<link href="/ws/customers/myaccount/campaigns/1109081646893" rel="edit"></link>
	<id>http://api.constantcontact.com/ws/customers/myaccount/campaigns/1109081646893" rel="edit"></link>
/campaigns/1109081646893</id>
	<title type="text">
	</title>
	<updated>2011-01-06T20:23:55.609Z</updated>
	<author>
	</author>
	<content type="application/vnd.ctct+xml">
		<Campaign xmlns="http://ws.constantcontact.com/ns/1.0/" id="http://api.constantcontact.com/ws/customers/myaccount/campaigns/1109081646893" rel="edit"></link>
/campaigns/1109081646893">
			<Name>test:2/28/2013 3:29:32 PM</Name>
			<Status>Draft</Status>
			<Date>2011-01-06T20:23:55.609Z</Date>
			<LastEditDate></LastEditDate>
			<Sent>0</Sent>
			<Opens>0</Opens>
			<Clicks>0</Clicks>
			<Bounces>0</Bounces>
			<Forwards>0</Forwards>
			<OptOuts>0</OptOuts>
			<SpamReports>0</SpamReports>
			<SharePageURL></SharePageURL>
			<Subject>test</Subject>
			<FromName>My Company</FromName>
			<CampaignType>CUSTOM</CampaignType>
			<ViewAsWebpage>YES</ViewAsWebpage>
			<ViewAsWebpageLinkText>Click here</ViewAsWebpageLinkText>
			<ViewAsWebpageText>Having trouble viewing this email?</ViewAsWebpageText>
			<PermissionReminder>YES</PermissionReminder>
			<PermissionReminderText>You're receiving this email because of your relationship with My Company.  Please &lt;ConfirmOptin&gt;&lt;a
			style="color:#0000ff;"&gt;confirm&lt;/a&gt;&lt;/ConfirmOptin&gt; your continued interest in receiving email from us. To ensure that you continue to receive emails from us, add &lt;Property
			name="ACCOUNT.SIGNATUREEMAIL"/&gt; to your address book today.</PermissionReminderText>
			<GreetingSalutation>Dear</GreetingSalutation>
			<GreetingName>FirstName</GreetingName>
			<GreetingString></GreetingString>
			<OrganizationName>My COmpany</OrganizationName>
			<OrganizationAddress1>Street</OrganizationAddress1>
			<OrganizationAddress2></OrganizationAddress2>
			<OrganizationAddress3></OrganizationAddress3>
			<OrganizationCity>City</OrganizationCity>
			<OrganizationState>FL</OrganizationState>
			<OrganizationInternationalState></OrganizationInternationalState>
			<OrganizationCountry>us</OrganizationCountry>
			<OrganizationPostalCode>99999</OrganizationPostalCode>
			<IncludeForwardEmail>YES</IncludeForwardEmail>
			<ForwardEmailLinkText>Forward email</ForwardEmailLinkText>
			<IncludeSubscribeLink>YES</IncludeSubscribeLink>
			<SubscribeLinkText>Subscribe me!</SubscribeLinkText>
			<EmailContentFormat>XHTML</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 bgcolor="#336699" align="center" valign="middle"&gt;&lt;CopyRight&gt;Copyright (c) 1996-2011 Constant Contact. All rights reserved.  Except as permitted under 
 a separate written agreement with Constant Contact, neither the Constant Contact software, nor any content that appears on any Constant Contact site, 
 including but not limited to, web pages, newsletters, or templates may be reproduced, republished, repurposed, or distributed without the 
 prior written permission of Constant Contact.  For inquiries regarding reproduction or distribution of any Constant Contact material, please 
 contact legal@constantcontact.com.&lt;/CopyRight&gt; 
 &lt;OpenTracking/&gt; 
 &lt;!--  Do NOT delete previous line if you want to get statistics on the number of opened emails --&gt; 
 &lt;center&gt;&lt;div class="containerindex"&gt; 
&lt;center&gt;&lt;div class="header"&gt;&lt;img src="http://domain.com/images/header.jpg" /&gt;&lt;/div&gt;&lt;/center&gt; this is a test&lt;/body&gt;&lt;/html&gt;</EmailContent>
			<EmailTextContent></EmailTextContent>
			<StyleSheet>.copyright{width: 900px;height: 125px;color: #FFFFFF;text-align: left;margin-left: auto;margin-right: auto;margin-top: 0px;position: relative;top: 0px;} .containerindex{width: 900px;background: #FFFFFF;text-align: left;margin-left: auto;margin-right: auto;margin-top: 0px;position: relative;top: 0px;} .header {position: absolute;width: 900px;height: 116px;background: #336699;top: 0px;} .main {width: 900px;background: #999999;position: absolute;top: 214px;padding: 10px; height:250px;}  .footer {width: 900px;height: 70px;background: #444444;margin-left: auto;margin-right: auto;position: relative;} .footerleft {width: 450px;background: #444444;text-align: left;position: absolute;left: 10px;top: 10px;} .footerright {width: 450px;background: #444444;text-align: right;position: absolute;right: 10px;top: 10px;} .footnav { width: 900px;height: 20px;background: #000000;margin-left: auto;margin-right: auto;position: relative;} .fnavleft {width: 450px;background: #000000;text-align: left;left: 10px;position: absolute;} .fnavright { width: 450px;background: #000000;text-align: right;right: 10px;position: absolute;} .addresstext {	font-family:Verdana, Geneva, sans-serif; font-size: 12px;  line-height: 16px; font-weight: normal; color: #ffffff; text-decoration:none;} .footertext { font-family: Verdana, Geneva, sans-serif; font-size: 10px;  line-height: 16px; font-weight: normal; color: #ffffff; text-decoration:none;} .maintext {	font-family: Verdana, Geneva, sans-serif; font-size: 12px;  line-height: 16px; font-weight: normal; color: #000000; text-decoration:none;} .email {font-family: Verdana, Geneva, sans-serif; font-size: 12px;  line-height: 16px; font-weight: bold; color: #ffffff; text-decoration:none;} .casetitle {	font-family: Verdana, Geneva, sans-serif; font-size: 12px;  line-height: 16px; font-weight: bold; color: #ffffff; text-decoration:none;} .link {	font-family: Verdana, Geneva, sans-serif; font-size: 12px;  line-height: 16px; font-weight: bold; color: #ffffff; text-decoration:none;} </StyleSheet>
			<ArchiveStatus></ArchiveStatus>
			<ArchiveURL></ArchiveURL>
			<ContactLists>
				<ContactList id="http://api.constantcontact.com/ws/customers/myaccount/campaigns/1109081646893" rel="edit"></link>
/lists/3">
				</ContactList>
			</ContactLists>
			<FromEmail>
				<Email id="http://api.constantcontact.com/ws/customers/proimaging/settings/emailaddresses/2">
					<link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/myaccount/campaigns/1109081646893" rel="edit"></link>
/settings/emailaddresses/2" rel="self"/>
				</Email>
				<EmailAddress>info@domain.com</EmailAddress>
			</FromEmail>
			<ReplyToEmail>
				<Email id="http://api.constantcontact.com/ws/customers/myaccount/campaigns/1109081646893" rel="edit"></link>
/settings/emailaddresses/2">
					<link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/proimaging/settings/emailaddresses/2" rel="self"/>
				</Email>
				<EmailAddress>info@domain.com</EmailAddress>
			</ReplyToEmail>
		</Campaign>
	</content>
</entry>

 Edited to add...  When I pasted the above code, I saw the error near the <link> and <id> tags, that error is no in my code, this is the top portion of my xml:

<link href="/ws/customers/myaccount/campaigns/1109081646893" rel="edit"></link>
	<id>http://api.constantcontact.com/ws/customers/myaccount/campaigns/1109081646893</id>

 I'm not sure why the extra link showed up above

Sorry, I noticed a bunch of errors in the above code, all due to pasting and editing in your window.  I just pasted the xml in to an editor here to remove all account information and here it is again...  Hopefully this time it will work correctly.:

<entry xmlns="http://www.w3.org/2005/Atom">
	<link href="/ws/customers/myaccount/campaigns/1109081646893" rel="edit"></link>
	<id>http://api.constantcontact.com/ws/customers/myaccount/campaigns/1109081646893</id>
	<title type="text">
	</title>
	<updated>2011-01-06T20:23:55.609Z</updated>
	<author>
	</author>
	<content type="application/vnd.ctct+xml">
		<Campaign xmlns="http://ws.constantcontact.com/ns/1.0/" id="http://api.constantcontact.com/ws/customers/myaccount/campaigns/1109081646893">
			<Name>test:2/28/2013 3:29:32 PM</Name>
			<Status>Draft</Status>
			<Date>2011-01-06T20:23:55.609Z</Date>
			<LastEditDate></LastEditDate>
			<Sent>0</Sent>
			<Opens>0</Opens>
			<Clicks>0</Clicks>
			<Bounces>0</Bounces>
			<Forwards>0</Forwards>
			<OptOuts>0</OptOuts>
			<SpamReports>0</SpamReports>
			<SharePageURL></SharePageURL>
			<Subject>test</Subject>
			<FromName>My Company</FromName>
			<CampaignType>CUSTOM</CampaignType>
			<ViewAsWebpage>YES</ViewAsWebpage>
			<ViewAsWebpageLinkText>Click here</ViewAsWebpageLinkText>
			<ViewAsWebpageText>Having trouble viewing this email?</ViewAsWebpageText>
			<PermissionReminder>YES</PermissionReminder>
			<PermissionReminderText>You're receiving this email because of your relationship with My Company  Please &lt;ConfirmOptin&gt;&lt;a
			style="color:#0000ff;"&gt;confirm&lt;/a&gt;&lt;/ConfirmOptin&gt; your continued interest in receiving email from us. To ensure that you continue to receive emails from us, add &lt;Property
			name="ACCOUNT.SIGNATUREEMAIL"/&gt; to your address book today.</PermissionReminderText>
			<GreetingSalutation>Dear</GreetingSalutation>
			<GreetingName>FirstName</GreetingName>
			<GreetingString></GreetingString>
			<OrganizationName>My Company</OrganizationName>
			<OrganizationAddress1>Street 1</OrganizationAddress1>
			<OrganizationAddress2></OrganizationAddress2>
			<OrganizationAddress3></OrganizationAddress3>
			<OrganizationCity>City</OrganizationCity>
			<OrganizationState>FL</OrganizationState>
			<OrganizationInternationalState></OrganizationInternationalState>
			<OrganizationCountry>us</OrganizationCountry>
			<OrganizationPostalCode>99999</OrganizationPostalCode>
			<IncludeForwardEmail>YES</IncludeForwardEmail>
			<ForwardEmailLinkText>Forward email</ForwardEmailLinkText>
			<IncludeSubscribeLink>YES</IncludeSubscribeLink>
			<SubscribeLinkText>Subscribe me!</SubscribeLinkText>
			<EmailContentFormat>XHTML</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 bgcolor="#336699" align="center" valign="middle"&gt;&lt;CopyRight&gt;Copyright (c) 1996-2011 Constant Contact. All rights reserved.  Except as permitted under 
 a separate written agreement with Constant Contact, neither the Constant Contact software, nor any content that appears on any Constant Contact site, 
 including but not limited to, web pages, newsletters, or templates may be reproduced, republished, repurposed, or distributed without the 
 prior written permission of Constant Contact.  For inquiries regarding reproduction or distribution of any Constant Contact material, please 
 contact legal@constantcontact.com.&lt;/CopyRight&gt; 
 &lt;OpenTracking/&gt; 
 &lt;!--  Do NOT delete previous line if you want to get statistics on the number of opened emails --&gt; 
 &lt;center&gt;&lt;div class="containerindex"&gt; 
&lt;center&gt;&lt;div class="header"&gt;&lt;img src="http://myaccount.ws/images/header.jpg" /&gt;&lt;/div&gt;&lt;/center&gt; this is a test&lt;/body&gt;&lt;/html&gt;</EmailContent>
			<EmailTextContent></EmailTextContent>
			<StyleSheet>.copyright{width: 900px;height: 125px;color: #FFFFFF;text-align: left;margin-left: auto;margin-right: auto;margin-top: 0px;position: relative;top: 0px;} .containerindex{width: 900px;background: #FFFFFF;text-align: left;margin-left: auto;margin-right: auto;margin-top: 0px;position: relative;top: 0px;} .header {position: absolute;width: 900px;height: 116px;background: #336699;top: 0px;} .main {width: 900px;background: #999999;position: absolute;top: 214px;padding: 10px; height:250px;}  .footer {width: 900px;height: 70px;background: #444444;margin-left: auto;margin-right: auto;position: relative;} .footerleft {width: 450px;background: #444444;text-align: left;position: absolute;left: 10px;top: 10px;} .footerright {width: 450px;background: #444444;text-align: right;position: absolute;right: 10px;top: 10px;} .footnav { width: 900px;height: 20px;background: #000000;margin-left: auto;margin-right: auto;position: relative;} .fnavleft {width: 450px;background: #000000;text-align: left;left: 10px;position: absolute;} .fnavright { width: 450px;background: #000000;text-align: right;right: 10px;position: absolute;} .addresstext {	font-family:Verdana, Geneva, sans-serif; font-size: 12px;  line-height: 16px; font-weight: normal; color: #ffffff; text-decoration:none;} .footertext { font-family: Verdana, Geneva, sans-serif; font-size: 10px;  line-height: 16px; font-weight: normal; color: #ffffff; text-decoration:none;} .maintext {	font-family: Verdana, Geneva, sans-serif; font-size: 12px;  line-height: 16px; font-weight: normal; color: #000000; text-decoration:none;} .email {font-family: Verdana, Geneva, sans-serif; font-size: 12px;  line-height: 16px; font-weight: bold; color: #ffffff; text-decoration:none;} .casetitle {	font-family: Verdana, Geneva, sans-serif; font-size: 12px;  line-height: 16px; font-weight: bold; color: #ffffff; text-decoration:none;} .link {	font-family: Verdana, Geneva, sans-serif; font-size: 12px;  line-height: 16px; font-weight: bold; color: #ffffff; text-decoration:none;} </StyleSheet>
			<ArchiveStatus></ArchiveStatus>
			<ArchiveURL></ArchiveURL>
			<ContactLists>
				<ContactList id="http://api.constantcontact.com/ws/customers/myaccount/lists/3">
				</ContactList>
			</ContactLists>
			<FromEmail>
				<Email id="http://api.constantcontact.com/ws/customers/myaccount/settings/emailaddresses/2">
					<link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/myaccount/settings/emailaddresses/2" rel="self"/>
				</Email>
				<EmailAddress>info@myaccount.ws</EmailAddress>
			</FromEmail>
			<ReplyToEmail>
				<Email id="http://api.constantcontact.com/ws/customers/myaccount/settings/emailaddresses/2">
					<link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/myaccount/settings/emailaddresses/2" rel="self"/>
				</Email>
				<EmailAddress>info@myaccount.ws</EmailAddress>
			</ReplyToEmail>
		</Campaign>
	</content>
</entry>

 

I figured it out....  I was missing the text content

Thank you for updating us.  

 

Best Regards,

Shannon W.

API Support Specialist

Developer Portal

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

Visit Page