ASP.NET and the Constant Contact API

Highlighted
Occasional Advisor

ASP.NET and the Constant Contact API

Has anyone yet tested the API using ASP.NET? If yes, can you post a sample used to pull a contact list or others?
Thank you,

Thank you,


Charles

5 REPLIES 5
Highlighted
Developer

re: ASP.NET and the Constant Contact API

Please see this post.

Thanks,
Tom M
Group Product Manager – Content Editing
Constant Contact
Highlighted
Occasional Organizer

Re: re: ASP.NET and the Constant Contact API

Link Not Working

WHD
Highlighted
CTCT Employee

Re: re: ASP.NET and the Constant Contact API

Hello,

 

I tried finding the exact post that this was linking to, but because we migrated our forums to this new developer board, I was not able to find the post.  However, I believe it was referring to our sample ASP.net code, which can be found here.  This code does have an example of pulling contact lists, and also has examples of much of our other API functions with ASP.net.

 

If you have any questions about this please let me know.

 

Regards,

Benjamin Soder
NOC Analyst
Constant Contact
Highlighted
Occasional Contributor

Re: re: ASP.NET and the Constant Contact API

Has the sample code been updated?  The only one I have found is, to be nice, inadequate.  How about some documentation of the methods?

 

Am I correct that your wrapper is extremely barebones and users are expected to go to the level of writing and processing the xml to use this "api"?

Highlighted
CTCT Employee

Re: re: ASP.NET and the Constant Contact API

Hi,

 

I'll pass along the feedback that you'd like the methods to be documented in another place besides the wrapper files.  The methods themselves can be found in Utility.cs for main methods and in the components files (such as ContactComponent.cs)  in the .NET wrapper.

 

The methods should pop up for you if you're using Visual Studio if you create a contact/list/email/other object, but I can understand wanting to know what you can do before diving in.  Below is how I use the .NET wrapper to add or update a contact as appropriate, to give you an idea of how to implement the wrapper.  You should not have to handle the XML yourself if you use the wrapper.

 

AuthenticationData authdata = new AuthenticationData("accessToken", "username");

//Contact add/update example
string _nextChunk;
string emailAddress = "test11212012@test.com";
List<string> email = new List<string>();
email.Add(emailAddress);
IList<Contact> myContact = Utility.SearchContactByEmail(authdata, email, out _nextChunk);

if (myContact.Count == 0)
{//Contact Does not exist, create new contact
	Contact thisContact = new Contact();
	thisContact.EmailAddress = emailAddress;

	//Add Lists to Contact
	ContactOptInList newList = new ContactOptInList();
	newList.ContactList = new ContactList("1"); //Contact list you want to add them to
	thisContact.ContactLists.Add(newList);
	thisContact.OptInSource = ContactOptSource.ActionByContact;

	//Add contact
	Utility.CreateNewContact(authdata, thisContact);
}

else
{//Contact does exist,  update existing
	//Get Contact by ID
	Contact thisContact = Utility.GetContactDetailsById(authdata, myContact[0].Id);

	//Add Lists
	ContactOptInList newList = new ContactOptInList();
	newList.ContactList = new ContactList("1"); //Contact list you want to add them to
	thisContact.ContactLists.Add(newList);
	thisContact.OptInSource = ContactOptSource.ActionByContact;

	//Update contact
	Utility.UpdateContactFullForm(authdata, thisContact);
}

 

 

Best Regards,

Shannon W.

API Support Specialist

Developer Portal

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

Visit Page

Constant Contact Would Like To Hear From You!

We want to hear from customers like you about your favorite features and how they have helped your business or organization. Tell us by answering a few questions in...

Read More
Featured