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

Highlighted
Occasional Participant

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

I am using your ASP Sample (C#) for the form titled: Add new Contact - Simplified Form


I updated web.config with my API key and login/password and can list contacts OK.


When I try to add a contact, I get the error: The remote server returned an error: (400) Bad Request.


Interestingly, I get the same error in the other C# sample project for Campaigns.


Either your samples are out of date, or something has changed on your server.


Regards, Garry @ TriSys


 

TriSys Business Software


Cambridge, United Kingdom


www.trisys.co.uk

2 REPLIES 2
Highlighted
Occasional Participant

The XML Being Submitted

 


This is the XML which is being submitted:


<entry xmlns=\"http://www.w3.org/2005/Atom\"><title type=\"text\"></title><updated>2008-07-23T14:21:06.407Z</updated><author></author><id>data:,none</id><summary type=\"text\">Contact</summary><content type=\"application/vnd.ctct+xml\"><Contact xmlns=\"http://ws.constantcontact.com/ns/1.0/\"><EmailAddress>xxxx@yyyyy.uk</EmailAddress><FirstName>Susan</...

d6><CustomField7></CustomField7><CustomField8></CustomField8><CustomField9></CustomField9><CustomField10></CustomField10><CustomField11></CustomField11><CustomField12></CustomField12><CustomField13></CustomField13><CustomField14></CustomField14><CustomField15></CustomField15><ContactLists><ContactList id=\"http://api.constantcontact.com/ws/customers/trisys/lists/2\"/></ContactLists></Contact></content></e...>


It is being submitted to


Is this the ago-old problem that US software has with UK data?


 


https://api.constantcontact.com/ws/customers/trisys/contacts

TriSys Business Software


Cambridge, United Kingdom


www.trisys.co.uk

Highlighted
CTCT Employee

XML 400 Error

I took a look at the XML that you are using, and was able to use it to successfully create a contact in my account. The only modification I needed to make was to the <OptInSource> node. You are currently using <OptInSource>ActionByContact</OptInSource>. However, the only 2 possible values for this are:


 


ACTION_BY_CONTACT - this is the action used for website sign up forms, when the contact signs themselves up for your list


 


ACTION_BY_CUSTOMER - this is used for internal applications when someone other than the contact is adding themselves to your mailing list.


 


Replacing "ActionByContact" with either of the above options should resolve the issue you are having creating a contact. I hope this helps.


 

David J

Developer Portal

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

Visit Page

Constant Contact Would Like To Hear From You!

We want to hear from customers like you about your favorite features and how they have helped your business or organization. Tell us by answering a few questions in...

Read More
Featured