cancel
Showing results for 
Search instead for 
Did you mean: 

ADD_CONTACTS Using C# Library

SOLVED
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!

4 REPLIES 4
Highlighted
CTCT 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

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

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
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#