The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

ADD_CONTACTS Using C# Library

SOLVED
Go to solution
Highlighted
Occasional Contributor

ADD_CONTACTS Using C# Library

Hi, I was able to perform a Bulk insert of Contacts to a list, using the REST API, but I was wondering if there is a way to do it using the C# Library?

 

I see an "Activity" object, but I don't see how to "Run" the activity?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Employee

Re: ADD_CONTACTS Using C# Library

The C# Library has a Utility.bulkUrlEncoded() function which can handle this for you. A quick example of using this would be:

 

AuthenticationData authdata = new AuthenticationData();
authdata.Username = "USERNAME";
authdata.Password = "PASSWORD";
authdata.ApiKey = "APIKEY";

List<string> lists = new List<string>();
String lineBreak = HttpUtility.UrlDecode("%0A");
lists.Add("https://api.constantcontact.com/ws/customers/{username}/lists/{list-id}");
String myString = "Email Address,First Name,Last Name" + lineBreak + "wstest3@example.com, Fred, Test" + lineBreak + "wstest4@example.com, Joan, Test";
String response = Utility.bulkUrlEncoded(authdata, myString, lists);
MessageBox.Show(response);

 

I hope this helps. Please let us know if you have any other questions or concerns regarding this. Thanks.

David J

View solution in original post

4 REPLIES 4
Highlighted
Employee

Re: ADD_CONTACTS Using C# Library

The C# Library has a Utility.bulkUrlEncoded() function which can handle this for you. A quick example of using this would be:

 

AuthenticationData authdata = new AuthenticationData();
authdata.Username = "USERNAME";
authdata.Password = "PASSWORD";
authdata.ApiKey = "APIKEY";

List<string> lists = new List<string>();
String lineBreak = HttpUtility.UrlDecode("%0A");
lists.Add("https://api.constantcontact.com/ws/customers/{username}/lists/{list-id}");
String myString = "Email Address,First Name,Last Name" + lineBreak + "wstest3@example.com, Fred, Test" + lineBreak + "wstest4@example.com, Joan, Test";
String response = Utility.bulkUrlEncoded(authdata, myString, lists);
MessageBox.Show(response);

 

I hope this helps. Please let us know if you have any other questions or concerns regarding this. Thanks.

David J

View solution in original post

Highlighted
Occasional Participant

Re: ADD_CONTACTS Using asp Library

i want to add bulk insert using the multipart using asp,net .please suggest how to add the multiple contacts using Multipart in  a version 2 API

Highlighted
Honored Contributor

Re: ADD_CONTACTS Using asp Library

Hello,

 

At this time we do not have any samples of code that will create a multipart upload request for our V2 API with the ASP.NET. If you are familiar with ASP.NET and multipart requests, you should be able to create this based on the information provided on our page for multipart requests here: http://developer.constantcontact.com/docs/bulk_activities_api/bulk-activities-addcontact-multipart.h...

 

We also have a forum post covering the topic of multipart requests in detail here: https://community.constantcontact.com/t5/Getting-Started-with-API-s/How-to-Import-Contacts-w-Multipa...

 

Best Regards,

Elijah G.
API Support Engineer
Highlighted
Occasional Participant

Re: ADD_CONTACTS Using asp Library

how to create the the ContactList using Asp.net in v2 .please give the apporiate json file to create a contact List  in asp or c# 

Developer Portal

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

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured