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.

{"The remote server returned an error: (409) Conflict."}

Highlighted
Participant

{"The remote server returned an error: (409) Conflict."}

Hi..


I'm trying to add contacts to a new list.. I get this on all the contacts.


The contacts may have been in other lists, too...


How do I add contacts to mulitple lists....   can you add contacts to more than one list?


thanks

5 REPLIES 5
Highlighted
Employee

update a contact

Hello,



In order to change information about a contact that is already in the account, you would need to do a PUT call on their contact URI, the the contacts current Contact XML and the changes that you would like to make.



So to add a customer to a new list, you would want to do a GET on the contacts URI, which can be found by doing a search for the contact by email address. Once you receive the ID, you would want to do a GET call, which will retrieve the contacts XML. Using the XML you will want to add or remove the contact list that you are trying to change, and then do a PUT call back to the contact ID with the new xml.



You can find out more about this process here. If you have any further questions please let me know.



Regards,

Benjamin Soder
NOC Analyst
Constant Contact
Highlighted
Participant

Can a contact be in multiple

Can a contact be in multiple lists?


I want Bob Smith in my Seminars List and Training List.


I'm using the .Net lib.  How do I add Bob Smith if he already exists in another list?


help...


thanks

Highlighted
Employee

update a contact

Hello,



Yes a contact can be on multiple lists.  The way this works in the API is that you would have more lists added to the <ContactLists> node.  When using the library, you would want to first search to see if the contact already exists using the SearchContactByEmail() function.  If the contact exists, you would then want to create an object of the contact using the GetContactDetailsById() function, with the Contact ID that you would get from the previous function.  You would want to add the new list to this object, and then update it back into our system with the UpdateContact() function.



Regards,

Benjamin Soder
NOC Analyst
Constant Contact
Highlighted
Participant

You mean

You mean Utility.UpdateContactFullForm... to UpdateContact()   ??


 


 


So I have to something like this...



 


string _nextChunkId;IList<Contact> lstContant = Utility.SearchContactByEmail(Get_Authentication(),emails,out _nextChunkId);if (lstContant.Count>0)Contact c = Utility.GetContactDetailsById(Get_Authentication(),lstContant.Id);ContactOptInList cl = new ContactOptInList();ContactOptSource.ActionByContact;new ConstantContactBO.ContactList(ID);Utility.UpdateContactFullForm(Get_Authentication(), c);else  // NEW CONTACT Contact = new Contact(dr.ToString(), dr.ToString(), dr.ToString());

 


 


c.OptInSource =


cl.ContactList =


c.ContactLists.Add(cl);


ContactOptInList cl = new ContactOptInList();ContactOptSource.ActionByContact;new ConstantContactBO.ContactList(ID);

 


 


 


 


 


{


 


 


 


c.OptInSource =


cl.ContactList =


c.ContactLists.Add(cl);


 


 


}


 



{


 



 

Highlighted
Employee

Re: You mean

I believe what you're looking to do would be similar to what I have below. This would add the contact if they do not exist, otherwise this would update the existing contact w/ the new Contact List.


AuthenticationData authdata = new AuthenticationData();

authdata.Username = "CC-USERNAME";

authdata.Password = "CC-PASSWORD";

authdata.ApiKey = "CC-APIKEY";



string emailAddress = "testaddress@example.com";



List<string> email = new List<string>();

email.Add(emailAddress);



ContactOptInList cl = new ContactOptInList();

cl.ContactList = new ConstantContactBO.ContactList("1");



string _nextChunkId;

IList<Contact> lstContant = Utility.SearchContactByEmail(authdata, email, out _nextChunkId);

if (lstContant.Count > 0)

{

    Contact c = Utility.GetContactDetailsById(authdata, lstContant.Id);

    c.OptInSource = ContactOptSource.ActionByContact;

    c.ContactLists.Add(cl);

    Utility.UpdateContactFullForm(authdata, c);

}

else

{

    Contact c = new Contact();

    c.EmailAddress = emailAddress;

    c.OptInSource = ContactOptSource.ActionByContact;

    c.ContactLists.Add(cl);

    Utility.CreateNewContact(authdata, c);

}

I hope this helps. Please let me know if you are running into any difficulties with this or have any other questions. Thanks!

David J

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