The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

getting 400 error on adding contact by api (PHP)

Highlighted
New Member

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
Highlighted
Employee

Re: getting 400 error on adding contact by api (PHP)

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

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured