Between 9pm - 11pm ET this Sat (9/18), we will be doing routine network maintenance. Please avoid usage of our API during this time frame - including any scheduled sync jobs. Thank you in advance for your patience.

400 Bad Request

freerobby
Participant

400 Bad Request

We have some code that worked a few weeks ago and is now returning 400 errors. I'm wondering why and if anything has changed on your end.


Ruby code from isolated example (using constant_contact gem):



ConstantContact::Contact.new(:email_address => "spam@freerobby.com", :first_name => "Robby", :last_name => "Grossman").save

Here's the encoded/generated XML:



<entry xmlns="http://www.w3.org/2005/Atom">
<title type="text"> </title>
<updated>2011-01-07T11:48:17Z</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/"><LastName>Grossman</LastName><EmailAddress>spam@freerobby.com</EmailAddress><FirstName>Robby</FirstName><OptInSource>ACTION_BY_CUSTOMER</OptInSource><ContactLists><ContactList id="http://api.constantcontact.com/ws/customers/oneforty/lists/1"/></ContactLists></Contact>
</content>
</entry>


 

1 REPLY 1
David_J
Employee

Your XML looks perfectly fine to me, and successfully created a contact in my account. I did notice however that you referenced list id 1, and it looks like you only have a list id 2 in your account.  This may have happened if you erased your initial list and created a new one.


 


You can obtain a listing of all contact lists in your account by performing a get on https://api.constantcontact.com/ws/customers/{user-name}/lists. For more information, please see Getting a Listing of Contact Lists.

David J

Developer Portal

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

Visit Page