We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

getting 400 error on adding contact by api (PHP)

miteshm
Participant

getting 400 error on adding contact by api (PHP)

When i try to add email address by api code i got below error :

 

The requested URL returned error: 400

Below is my post xml format :

 

<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom"><title>TitleNode</title><updated>2011-07-07T09:22:50+01:00</updated><author><name>CTCT Samples</name></author><id>urn:uuid:E8553C09F4xcvxCCC53F481214230867087</id><summary type="text">Customer document</summary><content type="application/vnd.ctct+xml"><Contact xmlns="http://ws.constantcontact.com/ns/1.0/">Customer document<EmailAddress>test123@test123.com</EmailAddress><FirstName></FirstName><LastName></LastName><MiddleName></MiddleName><CompanyName></CompanyName><JobTitle></JobTitle><OptInSource>ACTION_BY_CUSTOMER</OptInSource><HomePhone></HomePhone><WorkPhone></WorkPhone><Addr1></Addr1><Addr2></Addr2><Addr3></Addr3><City></City><StateCode></StateCode><StateName></StateName><CountryCode>US</CountryCode><PostalCode></PostalCode><SubPostalCode></SubPostalCode><Note></Note><EmailType>HTML</EmailType><ContactLists/></Contact></content></entry>

Please Help Me :(

 

Thanks

Mitesh

1 REPLY 1
bsoder
Employee

Hello,

 

I believe the reason you are receiving this 400 error is due to not having any contact lists listed in the XML.  When creating a new contact in the API, you must add the contact to at least one valid contact list.

 

If you have any questions please let me know!

 

Regards,

Benjamin Soder
NOC Analyst
Constant Contact
Developer Portal

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

Visit Page