Problems With Adding New Customer


Problems With Adding New Customer

Hello, my name is Tyler with Big Fat Web Design. I was having trouble figuring out the XML to add a new contact to our mailing lists and just wanted to know what your thought was on getting it up and running. We want to be able to add customers to our mailing lists when they register for our site. So I already have a form that adds all of their info to a MySQL database and I wanted to be able add them to our mailing list as they are doing that. I look at the "Add Me To Your Mailing List" buttons and text boxes that you have pre-made but I want it to be seamlessly integrated with our form. I have only had a little experience with XML and APIs to get information but never to add information so I am a little lost. If you could just point me in the right direction that would be much appreciated. Thanks


Hi Tyler,

We do offer some libraries and sample forms in various languages that can handle the process of adding a contact for you. You can view our code samples page for more information on those.


Regarding the actual process of signing contacts up for your mailing list you, as you are already adding contacts to your database, you would only need to add the functionality to place them in your Constant Contact account. This would involve taking the information that you are collecting and placing those details into XML representing a contact. You can find more details on that exact XML structure at Creating a Contact.


Once you have created that XML structure with the contact details, you would perform an http POST to{username}/contacts. In this POST you need to pass the request body in XML that represents the contact detail, and set  the request header, Content-type, to application/atom+xml. You can find more general information on these requests at the Contacts Collection and Resource.


I hope this helps point you in the right direction. If you have any other questions regarding this, please let us know. Thanks.


David J

Developer Portal

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

Visit Page