cancel
Showing results for 
Search instead for 
Did you mean: 

Error when removing contact from last list

New Member

Error when removing contact from last list

 I want to remove a contact from a list - even if it's the last list, but I don't want to opt-out the contact. This comes from someone hitting a newsletter "unsubscribe" button on the website.


So the documentation says:



To remove a contact from all lists, you need to start with the contact's detail data and simply remove all of the ContactList elements from the ContactLists element, and issue the PUT method on the contact resource:


https://api.constantcontact.com/ws/customers/{username}/contacts/{contact-id}


Removing a contact does not mean that the contact has unsubscribed or opted out of receiving emails.  It means the contact simply does not belong to any particular contact list, and can be added back to a list by the account owner.  However, this API should not be used if the contact has unsubscribed from receiving all emails.  Instead, you must opt-out the contact.


Which looks straightforward. My xml POST request contains:




<entry xmlns="http://www.w3.org/2005/Atom">
<link href="/ws/customers/*obfuscated*/contacts/*obfuscated*" rel="edit"/>
<id>http://api.constantcontact.com/ws/customers/*obfuscated*/contacts/*obfuscated*</id>
<title type="text">Contact: freddy@bloggs.com</title>
<updated>2011-02-05T20:13:59.928Z</updated>
<author>
<name>Constant Contact</name>
</author>
<content type="application/vnd.ctct+xml">
<Contact xmlns="http://ws.constantcontact.com/ns/1.0/" id="http://api.constantcontact.com/ws/customers/*obfuscated*/contacts/*obfuscated*">
<Status>Active</Status>
<EmailAddress>freddy@bloggs.com</EmailAddress>
<EmailType>HTML</EmailType>
<Name>Freddy Blogg</Name>
<FirstName>Freddy</FirstName>
<MiddleName/>
<LastName>Blogg</LastName>
<JobTitle/>
<CompanyName/>
<HomePhone/>
<WorkPhone/>
<Addr1/>
<Addr2/>
<Addr3/>
<City/>
<StateCode/>
<StateName/>
<CountryCode/>
<CountryName/>
<PostalCode/>
<SubPostalCode/>
<Note/>
<CustomField1/>
<CustomField2/>
<CustomField3/>
<CustomField4/>
<CustomField5/>
<CustomField6/>
<CustomField7/>
<CustomField8/>
<CustomField9/>
<CustomField10/>
<CustomField11/>
<CustomField12/>
<CustomField13/>
<CustomField14/>
<CustomField15/>
<ContactLists>

</ContactLists>
<Confirmed>false</Confirmed>
<InsertTime>2011-02-05T20:13:59.903Z</InsertTime>
<LastUpdateTime>2011-02-05T20:13:59.928Z</LastUpdateTime>
<OptInSource>ACTION_BY_CONTACT</OptInSource></Contact>
</content>
<source>
<id>http://api.constantcontact.com/ws/customers/*obfuscated*/contacts</id>
<title type="text">Contacts for Customer: *obfuscated*</title>
<link href="contacts"/>
<link href="contacts" rel="self"/>
<author>
<name>*obfuscated*</name>
</author>
<updated>2011-02-05T20:42:02.149Z</updated>
</source>
</entry>

which gets the following response:



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


Something which would seem to go against the documentation. What am I missing here? Is there a way to remove the last list without opt-out?


Martin

 




2 REPLIES 2
CTCT Employee

update a contact

Hello Martin,



I took a look at your XML and I was not able to recreate the error that you are having. When I take that XML and do a PUT call to my contacts ID, it updates the contact to the removed folder.



Can you verify that you are doing a PUT call and not a POST call? The error you are getting is the exact error you would get if you were trying to do a POST with that XML to the contacts URI.



If you are still having this issue and you have verified its a PUT call, can you send us the code to the Webservices Support team, so that we can take a look at what might be going on?



Regards,

Benjamin Soder
NOC Analyst
Constant Contact
Highlighted
Occasional Participant

Re: Error when removing contact from last list

I, too, ran into this error and couldn't figure out what the problem was. It turned out that I needed to set my OptInSource when doing the PUT to ACTION_BY_CUSTOMER when

<contactlists>

was empty.

 

Hope this helps somebody!