- Constant Contact Community
- :
- Developer Community
- :
- Getting Started with API's
- :
- Re: The ever popular Error 400: The request contai...
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
The ever popular Error 400: The request contains.. .
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-19-2011 01:18 PM
I've stripped out everything I thought might be contributing to the problem and still can't get it to post. I am trying to create a campaign for a managed partner.
<?xml version="1.0" encoding="UTF-8"?> <entry xmlns="http://www.w3.org/2005/Atom"> <link href="https://api.constantcontact.com/ws/customers/smckeefair/campaigns" rel="edit"/> <id/> <title type="text"/> <updated>2011-12-19T11:56:10:282Z</updated> <author> <name/> </author> <content type="application/vnd.ctct+xml"> <Campaign id="" xmlns="http://ws.constantcontact.com/ns/1.0/"> <Name>Spring Newsletter</Name> <Status>Draft</Status> <Date>2011-12-19T11:56:10:282Z</Date> <Subject>Spring Newsletter email</Subject> <FromName/> <ViewAsWebpage>NO</ViewAsWebpage> <ViewAsWebpageLinkText/> <ViewAsWebpageText/> <PermissionReminder>NO</PermissionReminder> <PermissionReminderText>Permission Reminder</PermissionReminderText> <GreetingSalutation>Dear</GreetingSalutation> <GreetingName>FirstName</GreetingName> <GreetingString/> <OrganizationName/> <OrganizationAddress1/> <OrganizationAddress2/> <OrganizationAddress3/> <OrganizationCity/> <OrganizationState/> <OrganizationInternationalState/> <OrganizationCountry/> <OrganizationPostalCode/> <IncludeForwardEmail>NO</IncludeForwardEmail> <ForwardEmailLinkText/> <IncludeSubscribeLink>NO</IncludeSubscribeLink> <SubscribeLinkText/> <EmailContentFormat>HTML</EmailContentFormat> <EmailContent/> <EmailTextContent/> <StyleSheet/> <ContactLists/> <FromEmail> <Email id=""> </Email> <EmailAddress>private@shawnmckee.net</EmailAddress > </FromEmail> <ReplyToEmail> <Email id=""> </Email> <EmailAddress>private@shawnmckee.net</EmailAddress > </ReplyToEmail> </Campaign> </content> <source> <id>https://api.constantcontact.com/ws/customers/smcke efair/campaigns</id> <title type="text">Campaigns for customer: smckeefair</title> <link href="campaigns"/> <link href="campaigns" rel="self"/> <author> <name>smckeefair</name> </author> <updated>2011-12-19T11:56:10:282Z</updated> </source> </entry>
Solved! Go to Solution.
Re: The ever popular Error 400: The request contains.. .
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-19-2011 02:15 PM
Hi Shawn:
A properly formatted FromEmail and ReplyToEmail nodes include the ID and Links to those addresses.
<FromEmail>
<Email id="http://api.constantcontact.com/ws/customers/joesfl owers/settings/emailaddresses/1">
<link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/joesflowers/settings/emailaddr esses/1"
rel="self" />
</Email>
<EmailAddress>joesflowers@example.com</EmailAddres s>
</FromEmail>
<FromEmail> and <ReplyToEmail> must be set with the account's confirmed email addresses and their values must be valid ID's from Account Settings and Email Address Resource.
Hope this helps, please let us know.
Thanks,
Associate Product Manager for EventSpot
Re: The ever popular Error 400: The request contains.. .
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-19-2011 03:01 PM
I've been using the Coldfusion sample code and it didn't include the <link> elements when it built the XML. I've updated it to handle that. Still no joy. All the rest of the packet remains the same.
<FromEmail>
<Email id="http://api.constantcontact.com/ws/customers/smckee
<link href="/ws/customers/smckeefair/contacts/1" rel="self" xmlns="http://www.w3.org/2005/Atom"/>
</Email>
<EmailAddress>private@shawnmckee.net</EmailAddress
</FromEmail>
<ReplyToEmail>
<Email id="private@shawnmckee.net">
<link href="/ws/customers/smckeefair/contacts/1" rel="self" xmlns="http://www.w3.org/2005/Atom"/>
</Email>
<EmailAddress>http://api.constantcontact.com/ws/customers/smckee
</ReplyToEmail>
Re: The ever popular Error 400: The request contains.. .
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-19-2011 03:38 PM
Hey Shawn,
The link href is to a verified email address on the account. The URI you should use is:
/ws/customers/smckeefair/settings/emailaddresses/1
Associate Product Manager for EventSpot
Re: The ever popular Error 400: The request contains.. .
[ Edited ]
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-19-2011 04:16 PM
Well I'm feeling fairly stupid for not noticing the rather major differences in those two but still no joy.
<FromEmail>
<Email id="http://api.constantcontact.com/ws/customers/smckee fair/settings/emailaddresses/1">
<link href="/ws/customers/smckeefair/settings/emailaddre sses/1" rel="self" xmlns="http://www.w3.org/2005/Atom"/>
</Email>
<EmailAddress>private@shawnmckee.net</EmailAddress >
</FromEmail>
<ReplyToEmail>
<Email id="http://api.constantcontact.com/ws/customers/smckee fair/settings/emailaddresses/1">
<link href="/ws/customers/smckeefair/settings/emailaddre sses/1" rel="self" xmlns="http://www.w3.org/2005/Atom"/>
</Email>
<EmailAddress>http://api.constantcontact.com/ws/customers/smckee fair/contacts/1</EmailAddress>
</ReplyToEmail>
Re: The ever popular Error 400: The request contains.. .
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-20-2011 09:54 AM
Hey Shawn,
I see a few more issues with the XML you provided. A Campaign ID and FromName were missing and the Campaign link was incorrect. You must have content in the email and text in the EmailTextContent; both need to be encoded. Below is the correct XML you should have:
<?xml version="1.0" encoding="UTF-8"?> <entry xmlns="http://www.w3.org/2005/Atom"> <link href="/ws/customers/smckeefair/campaigns" rel="edit"/> <id>http://api.constantcontact.com/ws/customers/smckeefair/campaigns</id> <title type="text"/> <updated>2009-10-19T18:34:53.105Z</updated> <author> <name>my new test for today</name> </author> <content type="application/vnd.ctct+xml"> <Campaign id="http://api.constantcontact.com/ws/customers/smckee fair/campaigns/1100546096289" xmlns="http://ws.constantcontact.com/ns/1.0/"> <Name>Spring Newsletter randome number</Name> <Status>Draft</Status> <Date>2011-12-19T11:56:10:282Z</Date> <Subject>Spring Newsletter email</Subject> <FromName>My New Name</FromName> <ViewAsWebpage>NO</ViewAsWebpage> <ViewAsWebpageLinkText/> <ViewAsWebpageText/> <PermissionReminder>NO</PermissionReminder> <PermissionReminderText>Permission Reminder</PermissionReminderText> <GreetingSalutation>Dear</GreetingSalutation> <GreetingName>FirstName</GreetingName> <GreetingString/> <OrganizationName/> <OrganizationAddress1/> <OrganizationAddress2/> <OrganizationAddress3/> <OrganizationCity/> <OrganizationState/> <OrganizationInternationalState/> <OrganizationCountry/> <OrganizationPostalCode/> <IncludeForwardEmail>NO</IncludeForwardEmail> <ForwardEmailLinkText/> <IncludeSubscribeLink>NO</IncludeSubscribeLink> <SubscribeLinkText/> <EmailContentFormat>HTML</EmailContentFormat> <EmailContent><html><body>test</body>< /html></EmailContent> <EmailTextContent><Text>Test</Text></EmailTe xtContent> <StyleSheet/> <ContactLists/> <FromEmail> <Email id="http://api.constantcontact.com/ws/customers/smckee fair/settings/emailaddresses/1"> <link href="/ws/customers/smckeefair/settings/emailaddre sses/1" rel="self" xmlns="http://www.w3.org/2005/Atom"/> </Email> <EmailAddress>private@shawnmckee.net</EmailAddress > </FromEmail> <ReplyToEmail> <Email id="http://api.constantcontact.com/ws/customers/smckee fair/settings/emailaddresses/1"> <link href="/ws/customers/smckeefair/settings/emailaddre sses/1" rel="self" xmlns="http://www.w3.org/2005/Atom"/> </Email> <EmailAddress>http://api.constantcontact.com/ws/customers/smckee fair/contacts/1</EmailAddress> </ReplyToEmail> </Campaign> </content> <source> <id>https://api.constantcontact.com/ws/customers/smcke efair/campaigns</id> <title type="text">Campaigns for customer: smckeefair</title> <link href="campaigns"/> <link href="campaigns" rel="self"/> <author> <name>smckeefair</name> </author> <updated>2011-12-19T11:56:10:282Z</updated> </source> </entry>
Hope this helps, let us know.
Thanks,
Associate Product Manager for EventSpot
Re: The ever popular Error 400: The request contains.. .
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-20-2011 11:06 AM
Excellent, that fixed all of the vague error messages and I hit a few others that were fairly easy to figure out. I'd have to say the CF sample code is lacking.
Re: The ever popular Error 400: The request contains.. .
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-20-2011 11:43 AM
Thank you Shawn,
We are sorry for the inconvenience. Sounds like it is time to revisit the code in the CF wrapper.
Thank you for the feedback,
Associate Product Manager for EventSpot
Re: The ever popular Error 400: The request contains.. .
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-16-2012 12:03 AM
I am stuck when trying to create a campaign using the C# wrapper. I've attempted to compare the text outputted from the wrapper function to the sample provided in the documentation and while I see a few minor differences nothing seems to be jumping out at me as the error... Below is the data that is being submitted to the WebService. I tried to highlight the differences that I noticed including the date time field, the campaign ID and email IDs (all zeros?) and finally the lack of the closing tags for the elements that did not have data. I am sure this is something simple that I am missing but so far I've been able to do everything thing else but the campaign creation...
Any help you can offer would be greatly appreciated!!
Thanks!
Re: The ever popular Error 400: The request contains.. .
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-16-2012 08:33 AM
I'm sure someone from CTCT will get to this soon but in the mean time I have one suggestion. I don't think 0 for the email address link is going to work. Needs to be number related to an actual address, probably 1 as that is the address of the CTCT account. Also don't follow it with a / just end with the number. The final email address tag also needs to be the full link not just the address.
As to the "missing" closing tag, the opening tag ending with a / closes it just like in XHTML.
Shawn


