Error while Updating contact Email through API

Occasional Participant

Error while Updating contact Email through API

Hi, I am implementing API in php. I have created a form which allow user to update there contact information. After form POST i am collecting records related to email and then updating that xml with request method as PUT. The problem is that sometimes its update contact email plus other details successfully but sometime it creates a new contact, instead of updating . I have searched a lot on API and forum but did not found anything related.

i have attached the XML i am using for update:

Please help.


The XML used for a POST and PUT in regards to creating a contact can be the exact same, and the differences between a POST and PUT can be as small as the HTTP method and the URL being submitted to. A new contact should never be created however if you are using the HTTP put method, as this will only update, and a post should only be creating a new contact.

It sounds like there may be some logic in your program to determine whether a contact exists or not. If the contact exists, it performs a put to the link for that contact (ie:{user-name}/contacts/{contact-id}), if not, it would perform a post to the contacts collection ({user-name}/contacts).

If you would like to send your PHP code to our webservices support team, I would be happy to take a look and see if I can assist in troubleshooting this.

David J

Occasional Participant

 this is the request url i am using:

Method: PUT

Return code: 204

i have  Attached XML in use in earlier post.


if i echo o/p after request then it looks some thing like this: <<>> 2010-08-11T09:41:52+01:00 Constant Contact Active HTML rr rr sdsad asds asd
asdsa asdasd
ACTION_BY_CONTACT 2010-08-11T00:45:00.374Z

ACTION_BY_CONTACT 2010-08-11T13:08:18.456Z

ACTION_BY_CONTACT 2010-08-11T14:26:59.160Z

ACTION_BY_CONTACT 2010-08-11T14:25:57.452Z

ACTION_BY_CONTACT 2010-08-11T13:07:40.437Z
false 2010-08-11T00:45:00.366Z 2010-08-11T14:36:32.652Z ACTION_BY_CONTACT

pushap 2010-08-11T16:41:52.450Z

PUT <<>>


I checked the result of check i applied for email existance and it always return me the responce object if contact exists.  Do i need to pass old email id in xml or only the new one which is being updated by user.



When doing a PUT to update a contact, the Contacts ID would never change, so you can pass the new email address, or any new information, to the URI with the Contact ID, such as what you had given as an example. This will change the email address of the contact, but the Contact ID will never change.

Whenever you do a PUT call, there is no functionality built in that would create a contact. The only way a new contact ID would be created is if you were doing a POST call.

If you are still having an issue with the code creating contacts when it should be updating, please feel free to send us your code, to the webservices support team.


Benjamin Soder
NOC Analyst
Constant Contact
Regular Participant

I am having a similar problem...

Every time I try to do an update, it returns a 409 error.

I took the example from your page:

Here is the xml


<entry xmlns="">
<title type="text">Contact:</title>

<content type="application/vnd.ctct+xml">
<Contact xmlns="" id="">

<ContactList id=""></ContactList>
<ContactList id=""></ContactList>

Email and Ids changed for privacy.


I used almost identical to create the user and all went well.

I verified that the curl method is PUT, but still NO JOY...

Any Ideas?



When you receive a 409 error it normally means that the XML you are using is not correct in some way. I noticed that you stated you were taking the create contact XML to do the PUT.

The reason this way is usually not advisable is because when doing a PUT call, the XML needs to be exactly the same as the current XML that is already assigned to that contact, except for the changes that are being made.

The best way to ensure that this is happening, is to do a GET call on the specific contact, and take the XML and modify it, and then return the XML to us with a PUT call. This will make sure that the XML is correct.

You can read more about this here.


Benjamin Soder
NOC Analyst
Constant Contact
Regular Participant

I reworked all of my code to use your cc_class.php methods for manipulating the Contact Data XML.

That seems to have fixed the issues.

Still there was a bunch of trial and error to determine what succeeded and failed, but its working now.

Thanks for your assistance on this.

Developer Portal

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

Visit Page