cancel
Showing results for 
Search instead for 
Did you mean: 

400 error when create a new contact

Frequent Visitor

400 error when create a new contact

I'm not able to figure out what I'm doing wrong.  I'm getting a 400 error when posting to:

 

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

 

Here is my xml:

 

<entry xmlns="http://www.w3.org/2005/Atom">  <title type="text"></title>  <updated>2011-08-25T01: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>bobp@vinomis.com</EmailAddress>      <OptInSource>ACTION_BY_CUSTOMER</OptInSource>      <ContactLists>        <ContactList id="http://api.constantcontact.com/ws/customers/***/lists/1" />      </ContactLists>    </Contact>  </content></entry>

 

List 1 is a valid list.  I get a 400 error back from the server.  Is there a way to get more information on what is causing the error?

 

 

1 REPLY 1
CTCT Employee

Re: 400 error when create a new contact

Hi,

It looks like the problem is with how your XML is formatted.  When I changed the spacing so that each node is on a separate line, it worked for me.  I have included an example below:

<entry xmlns="http://www.w3.org/2005/Atom"> 
<title type="text"></title>
<updated>2011-08-25T01: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>bobp@vinomis.com</EmailAddress>
<OptInSource>ACTION_BY_CUSTOMER</OptInSource>
<ContactLists>
<ContactList id="http://api.constantcontact.com/ws/customers/***/lists/1"/>     
</ContactLists>   
</Contact> 
</content>
</entry>

 

I hope this helps.  Please let me know if I can be of further assistance.

Matt R.
Support Engineer, Constant Contact