The remote server returned an error: (400) Bad Request.

Regular Participant

The remote server returned an error: (400) Bad Request.

Hi,


Downloaded the .Net campaigns sample from samples Forms section and provided the apikeys and credentials.


When i run the application it is giving the following error


The remote server returned an error: (400) Bad Request.


 


This is my xml data.


<?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'>Vijay</title>

<updated>2010-04-20T14:59:26.1093750+05:30</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/0000000000000' >

<Name>Vijay</Name><Status>Draft</Status><Date>2010-04-20T14:57:46.7968750+05:30</Date>

<Subject>Test this campagain</Subject><FromName>vijay</FromName><ViewAsWebpage>NO</ViewAsWebpage>

<ViewAsWebpageLinkText></ViewAsWebpageLinkText><ViewAsWebpageText></ViewAsWebpageText>

<PermissionReminder>YES</PermissionReminder><PermissionReminderText>You're receiving this email because of your relationship with myusername. Please confirm your continued interest in receiving email from us.</PermissionReminderText><GreetingSalutation>Dear</GreetingSalutation><GreetingName>FirstName</GreetingName>

<GreetingString>Sir</GreetingString><OrganizationName>Q1</OrganizationName>

<OrganizationAddress1>Hyd1</OrganizationAddress1><OrganizationAddress2>Hyd2</OrganizationAddress2>

<OrganizationAddress3>Hyd3</OrganizationAddress3><OrganizationCity>Hyderabad</OrganizationCity>

<OrganizationState></OrganizationState><OrganizationInternationalState></OrganizationInternationalState>

<OrganizationCountry>in</OrganizationCountry><OrganizationPostalCode>534122</OrganizationPostalCode>

<IncludeForwardEmail>NO</IncludeForwardEmail><ForwardEmailLinkText></ForwardEmailLinkText>

<IncludeSubscribeLink>YES</IncludeSubscribeLink><SubscribeLinkText></SubscribeLinkText>

<EmailContentFormat>HTML</EmailContentFormat><EmailContent>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;&gt;&lt;HTML&gt;&lt;HEAD&gt;&lt;TITLE&gt; New Document &lt;/TITLE&gt;&lt;META NAME=&quot;Generator&quot; CONTENT=&quot;EditPlus&quot;&gt;&lt;META NAME=&quot;Author&quot; CONTENT=&quot;&quot;&gt;&lt;META NAME=&quot;Keywords&quot; CONTENT=&quot;&quot;&gt;&lt;META NAME=&quot;Description&quot; CONTENT=&quot;&quot;&gt;&lt;/HEAD&gt;&lt;BODY&gt;This is vijay this is for test&lt;OpenTracking/&gt;&lt;!--  Do NOT delete previous line if you want to get statistics on the number of opened emails --&gt;&lt;CustomBlock name=&quot;letter.intro&quot; title=&quot;Personalization&quot;&gt;&lt;Greeting/&gt;&lt;/CustomBlock&gt;&lt;/BODY&gt;&lt;/HTML&gt; </EmailContent><EmailTextContent>&lt;Text&gt;Copyright (c) 1996-2009 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;/Text&gt;</EmailTextContent><StyleSheet></StyleSheet><ContactLists><ContactList id='http://api.constantcontact.com/ws/customers/myusername/lists/3'><link xmlns='http://www.w3.org/2005/Atom' href='/ws/customers/myusername/lists/3' rel='self' /></ContactList></ContactLists><FromEmail><Email id='http://api.constantcontact.com/ws/customers/myusername/settings/emailaddresses/4'><link xmlns='http://www.w3.org/2005/Atom' href='/ws/customers/myusername/settings/emailaddresses/4' rel='self' /></Email><EmailAddress>qualeetee@gmail.com</EmailAddress></FromEmail><ReplyToEmail><Email id='http://api.constantcontact.com/ws/customers/myusername/settings/emailaddresses/4'><link xmlns='http://www.w3.org/2005/Atom' href='/ws/customers/myusername/settings/emailaddresses/4' rel='self' /></Email><EmailAddress>qualeetee@gmail.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>2010-04-20T15:00:30.6875000+05:30</updated></source>

</entry>


Is there anything wrong in doing this. pls. let me know


Thanks,


vijay

4 REPLIES 4
Moderator

Hi vijay,


 


The problem you're seeing is in your SubscribeLink nodes.  You submitted this information:


 


<IncludeSubscribeLink>YES</IncludeSubscribeLink><SubscribeLinkText></SubscribeLinkText>


 


Notice that you said to include a SubscribeLink but you did not tell it the link text to use.  You would need to pass in content regarding the link text in order for this to work. 

Dave Berard
Senior Product Manager, Constant Contact
Regular Participant

Hi Dave,


Thanks for the reply. Still iam not able to resolve the issue


I updated my xml as per your findings. still its showing the same error. Please check the generated xml


 


<?xml version='1.0' encoding='UTF-8'?><entry xmlns="http://www.w3.org/2005/Atom"><link href="/ws/customers/anssrinivas/campaigns" rel="edit" /><id>http://api.constantcontact.com/ws/customers/anssrinivas/campaigns</id><title type="text">Vijay</title><updated>2010-04-22T12:13:30.0781250+05:30</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/anssrinivas/campaigns/0000000000000" ><Name>Vijay</Name><Status>Draft</Status><Date>2010-04-22T12:13:24.7343750+05:30</Date><Subject>News from Vijay</Subject><FromName>Vijay</FromName><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 anssrinivas. Please confirm your continued interest in receiving email from us.</PermissionReminderText><GreetingSalutation>Dear</GreetingSalutation><GreetingName>FirstName</GreetingName><GreetingString>Test</GreetingString><OrganizationName>Q1</OrganizationName><OrganizationAddress1>Banjara Hills</OrganizationAddress1><OrganizationAddress2>Hyd</OrganizationAddress2><OrganizationAddress3>Road3</OrganizationAddress3><OrganizationCity>Hyderabad</OrganizationCity><OrganizationState></OrganizationState><OrganizationInternationalState>AP</OrganizationInternationalState><OrganizationCountry>in</OrganizationCountry><OrganizationPostalCode>500035</OrganizationPostalCode><IncludeForwardEmail>NO</IncludeForwardEmail><ForwardEmailLinkText></ForwardEmailLinkText><IncludeSubscribeLink>NO</IncludeSubscribeLink><SubscribeLinkText></SubscribeLinkText><EmailContentFormat>HTML</EmailContentFormat><EmailContent>&lt;html lang=&quot;en&quot; xml:lang=&quot;en&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xmlns:cctd=&quot;http://www.constantcontact.com/cctd&quot;&gt;&lt;body&gt;&lt;CopyRight&gt;Copyright (c) 1996-2009 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;CustomBlock name=&quot;letter.intro&quot; title=&quot;Personalization&quot;&gt;&lt;Greeting/&gt;&lt;/CustomBlock&gt;&lt;/body&gt;&lt;/html&gt;</EmailContent><EmailTextContent>&lt;Text&gt;Copyright (c) 1996-2009 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;/Text&gt;</EmailTextContent><StyleSheet></StyleSheet><ContactLists><ContactList id="http://api.constantcontact.com/ws/customers/anssrinivas/lists/3"><link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/anssrinivas/lists/3" rel="self" /></ContactList></ContactLists><FromEmail><Email id="http://api.constantcontact.com/ws/customers/anssrinivas/settings/emailaddresses/4"><link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/anssrinivas/settings/emailaddresses/4" rel="self" /></Email><EmailAddress>qualeetee@gmail.com</EmailAddress></FromEmail><ReplyToEmail><Email id="http://api.constantcontact.com/ws/customers/anssrinivas/settings/emailaddresses/4"><link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/anssrinivas/settings/emailaddresses/4" rel="self" /></Email><EmailAddress>qualeetee@gmail.com</EmailAddress></ReplyToEmail></Campaign></content><source><id>http://api.constantcontact.com/ws/customers/anssrinivas/campaigns</id><title type="text">Campaigns for customer: anssrinivas</title><link href="campaigns" /><link href="campaigns" rel="self" /><author><name>anssrinivas</name></author><updated>2010-04-22T12:13:30.0781250+05:30</updated></source></entry>


 


Thanks,


Vijay


 

Moderator

Hi Vijay,


 


I ran your XML through my account and it created without issue.  I also see a campaign in your account created with this exact information at 9:36AM EST (about 6 minutes ago).  Is everything working for you now?

Dave Berard
Senior Product Manager, Constant Contact
Regular Participant

Hi


Iam able to resolve the issue. This time the problem is with from email which is not verified. After verifying its working.


Thanks,


Vijay

Developer Portal

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

Visit Page