We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

PHP - 409 error trying to update contact info

SheilaM28
Occasional Participant

PHP - 409 error trying to update contact info

Hi, hopefully someone can help me with this...

I have a form on a site I'm working on that allows users to submit their info.

When they submit, it runs a check to see if they already exist in thte contact list.

If they don't exist in the list already, they are added, if they do the script pulls their info and their record is updated.

 

At least, they SHOULD be updated, but instead it changes nothing and spits out the mysterious 409 error.

Everything up to the update call works - the add works, the dupe check works, pulling the user's info works, I get no errors until I try to actually update it.

 

I've tried looking up everything I can about this, and it's commonly claimed to be a conflict, but I don't understand how it can be a conflict when I'm trying to update an existing record!  I've also seen removing the email address and setting ACTION_BY_CONTACT instead of ACTION_BY_CUSTOMER to solve the error.  Neither of those work for me.

 

I can post the XML if that would help.

2 REPLIES 2
Shannon_W
Employee

Hi Sheila,

 

You've no doubt looked at our example XML for existing contacts as opposed to contacts who are being added.  The 409 often occurs when an id or other node in the XML doesn't reference the existing contact's unique id, which is a number.  I would check your XML against our sample updating contact XML (under "Contact Resource") to see if you can find an area where the sample references "/ws/customers/username/contacts/CONTACT_ID", and your XML only references "/ws/customers/username/contacts".  You should also be doing a PUT call to a URL that ends in the contact's id.

 

If you don't see any issues with your XML, feel free to post it (redacting your own username and email address used) and one of us can take a look.

 

Best Regards,

Shannon W.

API Support Specialist

SheilaM28
Occasional Participant

Thanks, Shannon!  I've got it working now.  I'm using the PHP API wrapper, and the sample XML helped me realize that I was missing a parameter to insert the URL with the ID, when I thought that was being inserted already.  

 

Another thing to note for anyone having this problem is that you will also get the 409 error if the API path being inserted into the XML starts with "https://" rather than "http://".

Developer Portal

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

Visit Page