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.

Opting Back In

Highlighted
Occasional Participant

Opting Back In

I am trying to create a form to opt a customer back into our list.   Using the same code, I can update a user and remove a user from a list without any issues.


I successfully get their user information.  I delete the Status node.  I add the OptInSource Node to the Contact node  I also make sure that ContactLists and ContactList nodes are present.  When I use the XMLDom to add the nodes, it does add an xmlns attribute to the new nodes.  I am not getting any errors, but the user is still in the do not mail lsit.


Here is the xml after I make my modifications.  I am using PUT and sending it to ../contacts/{ThecorrectUserId}



Any ideas on the problem?



<entry xmlns="http://www.w3.org/2005/Atom">


<link href="/ws/customers/BeckerHolding/contacts/7" rel="edit">
<id>http://api.constantcontact.com/ws/customers/BeckerHolding/contacts/7</id>

<updated>2010-12-16T20:12:24.503Z</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/BeckerHolding/contacts/7">
<emailaddress>sarahjoeyp@gmail.com</emailaddress>
<emailtype>HTML</emailtype>
<name>test person</name>
<firstname>test</firstname>
<middlename></middlename>
<lastname>person</lastname>


<jobtitle></jobtitle>
<companyname></companyname>
<homephone></homephone>
<workphone></workphone>
<addr1></addr1>
<addr2></addr2>
<addr3></addr3>
<city></city>
<statecode></statecode>


<statename></statename>
<countrycode></countrycode>
<countryname></countryname>
<postalcode></postalcode>
<subpostalcode></subpostalcode>
<note></note>
<customfield1></customfield1>
<customfield2></customfield2>
<customfield3></customfield3>


<customfield4></customfield4>
<customfield5></customfield5>
<customfield6></customfield6>
<customfield7></customfield7>
<customfield8></customfield8>
<customfield9></customfield9>
<customfield10></customfield10>
<customfield11></customfield11>
<customfield12></customfield12>


<customfield13></customfield13>
<customfield14></customfield14>
<customfield15></customfield15>
<confirmed>false</confirmed>
<inserttime>2010-12-16T17:09:51.520Z</inserttime>
<lastupdatetime>2010-12-16T20:12:24.503Z</lastupdatetime>
<optinsource xmlns="">ACTION_BY_CONTACT</optinsource><contactlists xmlns=""><contactlist id="http://api.constantcontact.com/ws/customers/BeckerHolding/lists/1"></contactlist></contactlists>


</contact>
<source>
<id>http://api.constantcontact.com/ws/customers/BeckerHolding/contacts</id>

<link href="contacts">
<link href="contacts" rel="self">
<author>
<name>BeckerHolding</name>
</author>


<updated>2010-12-17T04:27:16.061Z</updated>

</content>

 

1 REPLY 1
Highlighted
Employee

opting contact back in

Hello,



I did some testing and it does appear the issue you are having is with the xlmns="" on both the OptInSource and ContactLists nodes.  If you are able to remove these it should work.  Also please note that these nodes are case sensitive, so optinsource will not work, it must be OptInSource.



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