I'm using the API to update Contact Records using PUT on the /contacts endpoint. This part is fine, the issue I'm having is that PUT will wipe out any properties not set in the request, eg. first_name, last_name is wiped out if not added to the request.
To get around that - I'm trying to retrieve the Contact record first - using GET on /contacts/<contact_id>. The GET succeeds but only returns the "email_address" section, not the Name, Job, Anniversary etc. fields.
An example is below - TLDR - how can I get the Contact Name, Job, Anniversary etc. fields through the API?
Thank you.
eg:
https://api.cc.email/v3/contacts/bcc75816-6d95-11ef-a4ad-fa163ee2c965
responds with:
{ "contact_id": "bcc75816-6d95-11ef-a4ad-fa163ee2c965", "email_address": { "address": "emailaddress@fake.com", "permission_to_send": "explicit", "created_at": "2024-09-08T03:52:15Z", "updated_at": "2024-09-08T21:38:21Z", "opt_in_source": "Contact", "opt_in_date": "2024-09-08T03:52:15Z", "confirm_status": "off" }, "update_source": "Account", "create_source": "Contact", "created_at": "2024-09-08T03:52:15Z", "updated_at": "2024-09-08T21:38:21Z" }
Solved! Go to Solution.
Hello AidanO03,
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.
When Updating a contact, you 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.
To make a full GET /contacts call, you can just use the email address, rather than the contact ID, and then include all available values for the "include" query parameter in the "GET Contacts Collection" section of the API Reference page: https://v3.developer.constantcontact.com/api_reference/index.html#!/Contacts/getContacts
The request should look something like this:
GET
v3/contacts?status=all&email=xyz%40example.com&include=custom_fields%2Clist_memberships%2Cphone_numbers%2Cstreet_addresses%2Ctaggings%2Cnotes%2Csms_channel
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
Hello AidanO03,
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.
When Updating a contact, you 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.
To make a full GET /contacts call, you can just use the email address, rather than the contact ID, and then include all available values for the "include" query parameter in the "GET Contacts Collection" section of the API Reference page: https://v3.developer.constantcontact.com/api_reference/index.html#!/Contacts/getContacts
The request should look something like this:
GET
v3/contacts?status=all&email=xyz%40example.com&include=custom_fields%2Clist_memberships%2Cphone_numbers%2Cstreet_addresses%2Ctaggings%2Cnotes%2Csms_channel
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
Announcements
Join our list to be notified of new features and updates to our V3 API.
Sign Up