I am adding a contact to a list using XML.
First I tried getting the contact's information and adding the <ContactList> node to the XML under the <ContactLists> node with the ID of the list I am adding it to:
<ContactList id="http://api.constantcontact.com/ws/customers/[username]/lists/9" />
This returned a 204 status but the contact was not added to the list.
The cointact is already in list ID 1 and looking at the Contact data I noticed that (contrary to the documentation) there is an OptInSource node under the <ContactList> node for list 1. So I added an <OptInSource> node under the <ContactList> and tried it again:
<ContactList xmlns="" id="http://api.constantcontact.com/ws/customers/[username]/lists/9">
[username] is properly URL encoded.
Still returned a 204 status but the contact is not in the list.
What am I doing wrong?
After getting the XML, you are sending it back with an HTTP PUT? Also, is it possible for you to give us the full XML that you are sending over in the put call? I can try it on my end to see what is happening.
How are you getting the new list id? Are you getting it by pulling the list URI in the API, or are you getting it from the user interface? If I get the XML and cannot recreate your issue, I may also need your username and the email address you are trying to update, to see what is going on in the back end. You can email those here.
And just in case anyone else has run into this, it was the xmlns="" attribute in the <ContactList> node of the new list that was causing the problem. Once that was removed, the contact was added.