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.

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

Highlighted
New Member

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

adding a contact

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
Highlighted
New Member

Sometimes you look at

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..


 


 


 


 

Highlighted
Employee

adding an attribute to a node

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

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