Setting contact status via API

Frequent Participant

Setting contact status via API

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>

 

 

 

 

7 REPLIES 7
Frequent Participant

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.

 

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
Quality Engineer
Frequent Participant

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.

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

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

 

Regular Participant

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

 

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
Developer Portal

View API documentation, code samples, get your API key.

Visit Page