Showing results for 
Search instead for 
Did you mean: 

Quick Question

Occasional Contributor

Quick Question

When you are making an API call to update a Contact, how do I set some fields to NOT update?


For instance, you can set the city with something like:


contact.City = Server.HtmlEncode(txtCity.Text.Trim());


What if I want to leave the city alone (leave the City in Constant Contact intact), wouldn't


contact.City = "";


blank out the value in Constant Contact?


If I leave out that line where I set the city, will that not give me a Bad Request error?

CTCT Employee

Re: Quick Question

Hi Todd,


The best way to update a Contact is to first do a GET on that contact.  What you "GET" is the XML of the contact which contains all the required nodes for submitting a POST(Update).  By doing this, you guarantee the XML to be correct when sending it back to our server as well as preserving the data selected by the customer.


You then only change the content of the nodes you want updated and POST that XML back to us.


If you take the Node City and set it to blank like in your example, you are correct and you would be deleting that data from the system.  


Let me know if you have any further questions.  

Andrew Weber
Associate Product Manager for EventSpot
Occasional Contributor

Re: Quick Question

Thanks again!