It's nice that you guys will be adding it to the Github repository but I was wondering if you could look at my code and see what I'm doing wrong. It's VB.net. I think it's the whole Oauth with passing in the http headers thats the problem. Thanks a head of time. Imports System.IO Imports System.Text Imports System.Collections.Specialized Private Sub tyrout() Dim filename As String = "" Dim boundary As String = Guid.NewGuid().ToString() Dim request As HttpWebRequest = TryCast(HttpWebRequest.Create("https://api.constantcontact.com/v2/activities/addcontacts"), HttpWebRequest) request.Method = "POST" request.ContentType = String.Format("multipart/form-data") request.Accept = "application/json" 'request.PreAuthenticate = True Dim sb As New StringBuilder() sb.AppendFormat("--{0}", boundary) sb.AppendFormat(vbCr & vbLf) filename = "C:\Development\constantcontact\emailkust.csv" sb.AppendFormat("Content-Disposition: form-data; name=""media""; filename=""" & filename & """") sb.AppendFormat(vbCr & vbLf) sb.AppendFormat("Authorization: Bearer ") 'place the key from oauth here is my guess sb.AppendFormat(vbCr & vbLf) sb.AppendFormat("content-Type: multipart/form-data") sb.AppendFormat(vbCr & vbLf) sb.AppendFormat("lists: 75") 'list number I guess is where it should go sb.AppendFormat(vbCr & vbLf) sb.AppendFormat("api_key: ") 'place the api key here I think or should it go on the http path? sb.AppendFormat(vbCr & vbLf) Using fs As New FileStream(filename, FileMode.Open, FileAccess.Read) Dim contents As Byte() = New Byte(fs.Length - 1) {} fs.Read(contents, 0, contents.Length) sb.Append(Encoding.[Default].GetString(contents)) End Using sb.AppendFormat(vbCr & vbLf) sb.AppendFormat("--{0}--", boundary) Dim fulldata As Byte() = Encoding.[Default].GetBytes(sb.ToString()) request.ContentLength = fulldata.Length Using sw As Stream = request.GetRequestStream() sw.Write(fulldata, 0, fulldata.Length) End Using Dim response As HttpWebResponse = TryCast(request.GetResponse(), HttpWebResponse) Using sr As New StreamReader(response.GetResponseStream()) MessageBox.Show(sr.ReadToEnd()) End Using End Sub The csv file looks like this "EMAIL","LAST NAME","FIRST NAME" "1@one.org","1","1" "2@two.org","2","2" "3@three.org","3","3" "4@four.org","4","4"
... View more