Reply
Advisor
ShawnM641
Posts: 22
Registered: ‎12-01-2011

Setting contact status via API

[ Edited ]

It appears that ANY update to a contact via the API sets their status to active. I have tried this with a loaded <ContactList> and with an empty <ContactList> and regardless the contact is set to active. I have changed the status to removed via the console then run this and it goes back to active. I doubt it makes a difference but I'm using Coldfusion.

 

<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
	<title type="text"> </title>
	<updated>2011-12-30T10:07:35:972Z</updated>
	<author/>
	<id>http://api.constantcontact.com/ws/customers/CONTACTLOGIN/contacts/1</id>
	<summary type="text">Contact</summary>
	<content type="application/vnd.ctct+xml">
		<Contact xmlns="http://ws.constantcontact.com/ns/1.0/">
			<Status>Removed</Status>
			<EmailAddress>someone@mycompany.net</EmailAddress>
			<EmailType/>
			<FirstName>Shawn</FirstName>
			<MiddleName/>
			<LastName>McKee</LastName>
			<JobTitle/>
			<CompanyName/>
			<WorkPhone/>
			<HomePhone/>
			<Addr1/>
			<Addr2/>
			<Addr3/>
			<City/>
			<OptInSource>ACTION_BY_CUSTOMER</OptInSource>
			<StateCode/>
			<StateName/>
			<CountryCode>US</CountryCode>
			<PostalCode/>
			<SubPostalCode/>
			<CustomField1/>
			<CustomField2/>
			<CustomField3/>
			<CustomField4/>
			<CustomField5/>
			<CustomField6/>
			<CustomField7/>
			<CustomField8/>
			<CustomField9/>
			<CustomField10/>
			<CustomField11/>
			<CustomField12/>
			<CustomField13/>
			<CustomField14/>
			<CustomField15/>
			<Note/>
			<OptInSource>ACTION_BY_CUSTOMER</OptInSource>
			<ContactLists>
				<ContactList id="https://api.constantcontact.com/ws/customers/smckeefair/lists/1"/>
			</ContactLists>
		</Contact>
	</content>
</entry>

 

 

 

 

Advisor
ShawnM641
Posts: 22
Registered: ‎12-01-2011

Re: Setting contact status via API

Further investigation makes it seem like the real problem is that the BP UI is slow to catch up with changes made via the API. I am now getting consistent results from the API but they are not refleceted in the contact UI.

 

Ryan_D
Posts: 453
Topics: 0
Kudos: 20
Solutions: 21
Registered: ‎06-28-2011

Re: Setting contact status via API

Hey,

 

Which status where you trying to change it to?  If you are sending the changed status with an active contact list it would send it back to active.  If you were changing it to do not mail, then  you would just do a delete, instead of a PUT.

Ryan Davis
Support Engineer, Constant Contact
Advisor
ShawnM641
Posts: 22
Registered: ‎12-01-2011

Re: Setting contact status via API

At the moment I'm trying to flip them back and forth between active and removed for a given list. It seems to be working but the portal UI seems to be slow to see the updates. Not important now that I have figured that out.

DaveBerard
Posts: 1,635
Topics: 7
Kudos: 61
Solutions: 58
Registered: ‎06-19-2008

Re: Setting contact status via API

When you view a list in our Constant Contact UI, the list is cached on the server to improve performance.  Typically, the caching lasts only 5-10 minutes and you would not notice these types of "delays".  If you are looking for the data update to reflect immediately, you can log out of your account and back in after the API update.  This should clear the server cache since your session will end when you click Log Out.

 

Hope this helps.

Dave Berard
Senior Product Manager, Constant Contact
Advisor
ShawnM641
Posts: 22
Registered: ‎12-01-2011

Re: Setting contact status via API

Thanks, that is what I had surmised and it makes total sense. As long as my API calls reflect the last status set I'm fine.

 

Shawn

 

Occasional Contributor
NarasimhaV
Posts: 8
Registered: ‎01-05-2012

Re: Setting contact status via API

Hi Ryan,

 

I can able to sync the "DonotMail" contacts from Constant contact to Salesforce Object using API.

While working with this api call, i can get only the contacts which are available in "DonotMail" list.

 

My Question is,

How Can we retrieve the Active Contacts using   API?

 

 

Thanks

 

DaveBerard
Posts: 1,635
Topics: 7
Kudos: 61
Solutions: 58
Registered: ‎06-19-2008

Re: Setting contact status via API

Active contacts are available through a similar system list as Do Not Mail:

 

https://api.constantcontact.com/ws/customers/{username}/lists/active

Dave Berard
Senior Product Manager, Constant Contact