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.

Error 400: The new contact must contain at least on valid ContactList

fotofx
Occasional Participant

Error 400: The new contact must contain at least on valid ContactList

This XML seems like it should work. I can't figure out why I keep getting the 400 error. Can someone take a look.


 


<?xml version="1.0" encoding="utf-8"?>

<entry xmlns="http://www.w3.org/2005/Atom"><title>TitleNode</title><updated>2011-02-25T07:27:18+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>test@demo.net</EmailAddress><FirstName>John</FirstName><LastName>Doe</LastName><MiddleName></MiddleName><CompanyName></CompanyName><JobTitle></JobTitle><OptInSource>ACTION_BY_CUSTOMER</OptInSource><HomePhone>999999999</HomePhone><WorkPhone></WorkPhone><Addr1>123 ABC St</Addr1><Addr2></Addr2><Addr3></Addr3><City>Anytown</City><StateCode>FL</StateCode><StateName></StateName><CountryCode></CountryCode><PostalCode>33333</PostalCode><SubPostalCode></SubPostalCode><Note>Test for constant contact</Note><EmailType></EmailType><ContactLists>http://api.constantcontact.com/ws/customers/xxxxxx/lists/1</ContactLists></Contact></content></entry>

 


 I changed the necessary information to protect the innocent.


 

3 REPLIES 3
bsoder
Employee

Hello,



I looked over your XML, and I do see what the issue is. You currently have it set up so that you have a ContactLists node, and inside of it, you list the List URI. The way it needs to be has to look like this:


<contactlists>

<contactlist id="http://api.constantcontact.com/ws/customers/joesflowers/lists/1">

</contactlist>
Benjamin Soder
NOC Analyst
Constant Contact
fotofx
Occasional Participant

Sometimes you look at something too long and just get more confused.


 


$contact_node = $content_node->addChild("ContactLists");

$contact_node->addChild("ContactList");

$contact_node->addAttribute("id", "http://api.constantcontact.com/ws/customers/xxxxxx/lists/1");

 


Is creating this:


 


<ContactLists id="http://api.constantcontact.com/ws/customers/xxxxxx/lists/1"><ContactList/>


 


I have to be close... Any help please..


 


 


 


 

bsoder
Employee

Hello,



I believe the issue is you are adding the attribute to the original $contact_node. You must put the node "ContactList" as a variable, like $contact_list = $contact_node->addChild("ContactList");. Then you would be able to do $contact_list->addAttribute("id", "http://api.constantcontact.com/ws/customers/xxxxxx/lists/1");.



If you have any questions about this please let me know.

Benjamin Soder
NOC Analyst
Constant Contact
Developer Portal

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

Visit Page