Hi,
I'm trying to figure out how to delete obsolete contact street addresses through the API.
Example:
The documentation for PUT /contacts/{contact_id} says:
Add or change any of the subresources by including them in the PUT request payload. Omitted subresources are not overwritten with null.
How can we get rid of the old address?
Solved! Go to Solution.
Okay, I think I have my answer. In my testing:
Example:
The documentation, and Courtney's helpful answer, made it clear that omitting street_addresses altogether would preserve all existing street addresses for that contact, making no changes. But I wasn't sure what would happen if street_addresses were included but the only item in the array were a new address. Would the new address be added to the contact's list of addresses, or would it replace them? I.e., is street_addresses incremental or full?
Based on my testing, street_addresses seems to do a full replacement of any existing addresses.
Constant Contact team or anyone else who stumbles upon this, please correct me if I'm wrong.
Anyone here?
Hello user558013,
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.
You can use this flow to update your contacts which incorporates two contact endpoints:
Step 1: Get the existing contact data using the "email" query parameter to search for a contact using a specific email address.
GET Contacts Collection
https://v3.developer.constantcontact.com/api_reference/index.html#!/Contacts/getContacts
Step 2: Append/modify the returned data (such as removing the physical address in question) and update the schema of the response body from the previous call so that it is correct for the request body when calling PUT /contacts.
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/blank value.
PUT (update) a Contact
https://v3.developer.constantcontact.com/api_reference/index.html#!/Contacts/putContact
Please have a look and let us know if you have any other questions!
You can also reach our team directly/securely via email at webservices@constantcontact.com and reference case #33082865
Hi Courtney,
Thanks for the reply!
I think that makes sense.
Do I have this right:
So, in my example, we could delete "456 Cherry Blossom Ln" from John Smith's street addresses like this:
"street_addresses": [{"kind": "home", "street": "123 Linden Ave", "city" ... }]
I.e., we only include "123 Linden Ave" in the street addresses array. "456 Cherry Blossom Ln" isn't there, so it's deleted.
To rephrase what I have above, my understanding is:
Is that right?
Eric
Okay, I think I have my answer. In my testing:
Example:
The documentation, and Courtney's helpful answer, made it clear that omitting street_addresses altogether would preserve all existing street addresses for that contact, making no changes. But I wasn't sure what would happen if street_addresses were included but the only item in the array were a new address. Would the new address be added to the contact's list of addresses, or would it replace them? I.e., is street_addresses incremental or full?
Based on my testing, street_addresses seems to do a full replacement of any existing addresses.
Constant Contact team or anyone else who stumbles upon this, please correct me if I'm wrong.
Announcements
Join our list to be notified of new features and updates to our V3 API.
Sign Up