List Membership changes on Update

SOLVED
Go to solution
RobertM42
Campaign Contributor
0 Votes

When we PUT an update to a contact: If we provide a set of List Memeberships, does it REPLACE the current memberships with the new ones, or does it just ADD any new ones to the existing ones?

 

Thanks for any help.

1 ACCEPTED SOLUTION
Courtney_E
Moderator
0 Votes

Hello RobertM42,

 

Thank you for reaching out to Constant Contact API Developer Support. My team is here to assist outside software developers with questions about building into Constant Contact's API.

 

Using PUT /contacts/{contact_id} to update an existing contact will use whatever data you send to overwrite the existing data, this is why you should always make a GET /contacts call first.

 

When Updating a contact, we need to append the new information to the old information and send all of it back in the request, because when you update a contact using a PUT, all properties are updated, overwriting all existing property values. Any properties left blank or not included in the PUT will be overwritten with a null value.

 

If you want to use an endpoint that will add new list memberships to a contact without affecting any exiting memberships or other contact details, I'd instead recommend using our Bulk Activity endpoints for adding contacts, which works similarly to when you upload a spreadsheet of contacts within the website UI:

 

Import Contacts using a JSON Payload

https://v3.developer.constantcontact.com/api_reference/index.html#!/Bulk_Activities/bulkImportContac...

 

Import Contacts using a CSV File

https://v3.developer.constantcontact.com/api_reference/index.html#!/Bulk_Activities/contactsCSVImpor...

 

Please have a look and let us know if you have any other questions!


Regards,

Courtney E.
Tier II API Support Engineer

Did I answer your question?
If so, please mark my post as an "Accepted Solution" by clicking the Accept as Solution button in the bottom right hand corner of this post.

View solution in original post

2 REPLIES 2
Courtney_E
Moderator
0 Votes

Hello RobertM42,

 

Thank you for reaching out to Constant Contact API Developer Support. My team is here to assist outside software developers with questions about building into Constant Contact's API.

 

Using PUT /contacts/{contact_id} to update an existing contact will use whatever data you send to overwrite the existing data, this is why you should always make a GET /contacts call first.

 

When Updating a contact, we need to append the new information to the old information and send all of it back in the request, because when you update a contact using a PUT, all properties are updated, overwriting all existing property values. Any properties left blank or not included in the PUT will be overwritten with a null value.

 

If you want to use an endpoint that will add new list memberships to a contact without affecting any exiting memberships or other contact details, I'd instead recommend using our Bulk Activity endpoints for adding contacts, which works similarly to when you upload a spreadsheet of contacts within the website UI:

 

Import Contacts using a JSON Payload

https://v3.developer.constantcontact.com/api_reference/index.html#!/Bulk_Activities/bulkImportContac...

 

Import Contacts using a CSV File

https://v3.developer.constantcontact.com/api_reference/index.html#!/Bulk_Activities/contactsCSVImpor...

 

Please have a look and let us know if you have any other questions!


Regards,

Courtney E.
Tier II API Support Engineer

Did I answer your question?
If so, please mark my post as an "Accepted Solution" by clicking the Accept as Solution button in the bottom right hand corner of this post.
RobertM42
Campaign Contributor
0 Votes

To make it work did as you suggested.  1) Try to get  the contact using email address.  If no match, add new contact.  If match, capture the current values I need, append them to the values passed in, then Put the data back to just append the new list data as needed to the contact instead of changing the lists.

Resources
Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Announcements

API Updates

Join our list to be notified of new features and updates to our V3 API.

Sign Up