Bulk contact delete/add from the list

Regular Participant

Bulk contact delete/add from the list

Hi there,


Here I am listing partial code for the contact lists removal from the activity but I'm a getting


The remote server returned an error: (415) Unsupported Media Type.


Here is the code as follows



HttpWebRequest



oRequest = null;HttpWebRequest)LoginCredReq("https://api.constantcontact.com/ws/customers/coolantu/lists");"multipart/form-data; boundary=" + PostData.boundary;"POST";PostData pData = new PostData();Encoding encoding = Encoding.UTF8;Stream oStream = null;new PostDataParam("activityType", "CLEAR_CONTACTS_FROM_LISTS", PostDataParamType.Field));new PostDataParam("lists", "http://api.constantcontact.com/ws/customers/coolantu/lists/1", PostDataParamType.Field));// pData.Params.Add(new PostDataParam("fileupload", "filename.txt", "filecontents" PostDataParamType.File));

 


 


oRequest.ContentLength = buffer.Length;


oStream = oRequest.GetRequestStream();


oStream.Write(buffer, 0, buffer.Length);


oStream.Close();


 


byte[] buffer = encoding.GetBytes(pData.GetPostData());HttpWebResponse oResponse = (HttpWebResponse)oRequest.GetResponse();


oRequest = (


oRequest.ContentType =


oRequest.Method =


 


 


 


 


pData.Params.Add(


pData.Params.Add(


 

2 REPLIES 2
Regular Participant

Hello,


I am currently reviewing your provided code and will get back to you shortly.

Andrew T

Support Engineer, Constant Contact

Regular Participant

Hi Andrew,


Sorry for the post I already resolved the issue. But I'm experiening a new issue which I already posted as new forum it's adding contact(s) to the list in activity.It's giving me WebException:ProtocolErrorThe remote server returned an error: (400) Bad Request.

Developer Portal

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

Visit Page