That is what the script I posted above does. If the contact is new, it adds them. If the contact exists already, it updates them to make sure they are added to a list in the account.
Sorry, but I don't have any Java examples of this.
API Support Specialist
I'm using following for PUT method, giving 415 error. What's wrong with it? Thanks!
<link href="/ws/customers/testUser/contacts/212" rel="edit"></link>
<title type="text">Contact: firstname.lastname@example.org</title>
<Contact xmlns="http://ws.constantcontact.com/ns/1.0/" id="http://api.constantcontact.com/ws/customers/testUser/contacts/212">
A 415 error typically comes from an invalid content-type header, or not setting one. You'll need to set it as
If you currently have that set, just let us know, and we can take a deeper look.
Thanks that worked! Ok,
1) So when I update the contact(existing email) with different details will it be seding confirmation email again to the user or not?
2) When update happens will it override existing details?
3) I want to update existing contact only when it's not there in list but registered. But when it's in the list not yet exported then I don't want to update. What can I do for this? This is very very importatnt for my clients. Please let me know if you need clarification on this.
Thank you so much for your help on this!
I'm glad you got this working.
1. If you set the Opt in source to ACTION_BY_CONTACT, then the user will get an update notification but not a welcome email, since they've already received that once when they first subscribed. If you set the opt in source to ACTION_BY_CUSTOMER, no emails will be sent.
2. Yes, you will override existing contact details when you use the update function.
3. It sounds like you need to build in logic to check if the user is registered or not before you use the update function.
API Support Specialist
Thanks for you reply!
Re. #3, I'm checking whether registered or not, but what do I need to do for checking whether it's there in active list or not?
I would need some of the other info so soon. Is there a way I could reach you guys? Please let me know. Thanks!
For #3 you can submit a GET request in this format to our API in order to check if a contact exists and is active:
If successful, this request will return limited details of the contact or fail if the email address does not match a contact on your account. You can find more information about this request here:
As a side note, you can then pass another request for more detailed information to our API using the contact's ID and the request format specified here: http://community.constantcontact.com/t5/Documentation/Obtaining-a-Contact-s-Information/ba-p/25057
In addition, if you do need to be able to speak with someone from our API support team, you would need to send an email to email@example.com and let us know what date/time is best for you. We will be sure to get back to you and let you know if there's a scheduling conflict or if we can connect at that time.
Tier 2 Support