Master email marketing fundamentals and transform your business. Join the Ready, Set, Send Challenge!

Retrieving Contact Name / Job Details etc.

SOLVED
Go to solution
AidanO03
Rookie
0 Votes

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" }

 

 

 

1 ACCEPTED SOLUTION
Courtney_E
Moderator
0 Votes

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


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

1 REPLY 1
Courtney_E
Moderator
0 Votes

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


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.
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