Error 400: Bad Request

lucianchiriac
Occasional Participant

Error 400: Bad Request

Hi, i am receiving Error 400 from the server while posting a new contact (The remote server returned an error: (400) Bad Request.)


The XML is:


<entry xmlns="http://www.w3.org/2005/Atom">

  <title type="text" />

  <updated>2008-07-23T14:21:06.407Z</updated>

  <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>gigi@gelu.com</EmailAddress>

  <FirstName />

  <MiddleName />

  <LastName>Bouzek</LastName>

  <HomePhone />

  <Addr1 />

  <Addr2 />

  <Addr3 />

  <City />

  <StateCode />

  <StateName />

  <PostalCode />

  <SubPostalCode />

  <CountryCode />

  <CompanyName />

  <JobTitle />

  <WorkPhone />

  <EmailType>HTML</EmailType>

  <OptInSource>ACTION_BY_CUSTOMER</OptInSource>

  <Note />

  <CustomField1>District of Delaware</CustomField1>

  <CustomField2>XXXXX</CustomField2>

  <CustomField3>YYYYY</CustomField3>

  <CustomField4 />

  <CustomField5>09-12019 (CSS)</CustomField5>

  <CustomField6 />

  <CustomField7>09/10/2010</CustomField7>

  <CustomField8>92a275ef02c64e04a9ff0dd3059c5b48</CustomField8>

  <CustomField9>GIGEL</CustomField9>

  <CustomField10>Ms.</CustomField10>

  <CustomField11 />

  <CustomField12 />

  <CustomField13 />

  <CustomField14 />

  <CustomField15 />

 <ContactLists>

  <ContactList id="http://api.constantcontact.com/ws/customers/claimsrecovery/lists/General Interest" />

  </ContactLists>

  </Contact>

  </content>

  </entry>


Also, i would like to send a batch of more than one contacts (either new or updates) instead of sending them one by one. Is this possible?


 


Thank you

6 REPLIES 6
bsoder
Employee

Hello,



I have looked over your XML and I believe you are getting the 400 error because of the way you have the List node. The list URI has to lead to the lists actual LIST ID, not the name of the list.



Usually, your General Interest list is list 1, so instead of what you have, the list would be http://api.constantcontact.com/ws/customers/(USERNAME)/lists/1.



If you have any questions please let me know.



Regards,

Benjamin Soder
NOC Analyst
Constant Contact
GlennO3
Occasional Participant

How do you know what the List ID is?  Is it the same as Order?   (i.e. if I change the order of the lists, am I changing the list's ID too?)

 

Hey,

 

You can get the list-id by doing a get to your list collections.  You can find out more about this here.

 

Please let me know if this helps.

Ryan Davis
Quality Engineer
GlennO3
Occasional Participant

Thank you for your prompt answer!

 

OK I used RestClient to get the information so it was relatively painless.  :-)

 

Thanks for the help!  Got the correct ID now.  But if you just display the ID on the website, that would probably be a handy thing to be able to see.

 

To get the id of a list in the admin you can just mouse over the list name link and look at the url in the browser status bar.

lucianchiriac
Occasional Participant

Thank you, it worked.

Developer Portal

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

Visit Page