Code Samples: .NET (C#) Sample Forms Error 400: Bad Request

SOLVED
Highlighted
Occasional Contributor

Code Samples: .NET (C#) Sample Forms Error 400: Bad Request

I do apologize as I know this has been asked before, however I am relatively new to the API and am not sure what may be wrong in my xml.

 

I downloaded the Sample Forms, and just tried simply adding a contact out of the box. I plugged in my API key and it retrieves my lists so I know it is connecting. However, when I click add, I get 'The remote server returned and error. (400) Bad Request.'

 

Here is my xml, pretty simple:

 

<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>john@doe.com</EmailAddress>
	<FirstName>John</FirstName>
	<MiddleName></MiddleName>
	<LastName>Doe</LastName>
	<HomePhone></HomePhone>
	<Addr1></Addr1>
	<Addr2></Addr2>
	<Addr3></Addr3>
	<City></City>
	<StateCode></StateCode>
	<StateName></StateName>
	<PostalCode></PostalCode>
	<SubPostalCode></SubPostalCode>
	<CountryCode></CountryCode>
	<CompanyName></CompanyName>
	<JobTitle></JobTitle>
	<WorkPhone></WorkPhone>
	<EmailType>HTML</EmailType>
	<Note></Note>
	<CustomField1></CustomField1>
	<CustomField2></CustomField2>
	<CustomField3></CustomField3>
	<CustomField4></CustomField4>
	<CustomField5></CustomField5>
	<CustomField6></CustomField6>
	<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/myaccountname/lists/1\"/>
		<ContactList id=\"http://api.constantcontact.com/ws/customers/myaccountname/lists/11\"/>
	</ContactLists>
</Contact>
</content>
</entry>"

 

What am I missing? Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
CTCT Employee

Re: Code Samples: .NET (C#) Sample Forms Error 400: Bad Request

Hi Todd,

 

You are missing a node:

 

<OptInSource>ACTION_BY_CUSTOMER</OptInSource>

 

See this link for all required nodes.

Andrew Weber
Associate Product Manager for EventSpot

View solution in original post

2 REPLIES 2
Highlighted
CTCT Employee

Re: Code Samples: .NET (C#) Sample Forms Error 400: Bad Request

Hi Todd,

 

You are missing a node:

 

<OptInSource>ACTION_BY_CUSTOMER</OptInSource>

 

See this link for all required nodes.

Andrew Weber
Associate Product Manager for EventSpot

View solution in original post

Highlighted
Occasional Contributor

Re: Code Samples: .NET (C#) Sample Forms Error 400: Bad Request

That was it, thank you!

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