AnsweredAssumed Answered

"Invalid Content Type" when attempting Bulk Leads Import

Question asked by 3eb476812c2a59988d2f419a3eaea69e98b45cc3 on Oct 6, 2017
Latest reply on Oct 6, 2017 by 3eb476812c2a59988d2f419a3eaea69e98b45cc3

I am attempting to import a CSV file using the Bulk Leads Import API with Classic ASP (VB Script).  I have tried reading the CSV file into a string and including in the POST payload, as well as attaching the CSV file.


No matter what I do, I get an "Invalid Content Type."

{"requestId":"15f34#15ef18d4773","success":false,"errors":[{"code":"612","message":"Invalid Content Type"}]}


I have tried 5-10 different content types.  I get the same error when I attempt to attach the CSV file.  Anyone know how I can fix the error?


Also, if I use the method of reading the CSV into a string, am I adding the line termination correctly (cbCRLF or CHR(13)&CHR(10))



Set xmlHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")

xmlHTTP.Open "POST", "", false


xmlHTTP.setRequestHeader "content-type", "text/csv"

'I have also tried these content-types:

' application/x-www-form-urlencoded

' application/

' application/json

' text/plain

' application/csv

' multipart/form-data


dim strData, strLine

strData = ""

strData=strData & "------WebKitFormBoundaryBQACkJZyaiIAXogC" & vbCrLf

strData=strData & "Content-Disposition: form-data; name=""file""; filename=""leads.csv""" & vbCrLf

'strData=strData & "Content-Disposition: attachment;filename=MarketoProspects.csv"                               'I have also tried attaching the CSV file


strData=strData & "FirstName,LastName,Email,Company" & vbCrLf                                                             'vbCRLF=Chr(13)&Chr(10)

strData=strData & "Able,Baker,,Marketo" & vbCrLf

strData=strData & "Charlie,Dog,,Marketo" & vbCrLf

strData=strData & "Easy,Fox,,Marketo" & vbCrLf

strData=strData & "------WebKitFormBoundaryBQACkJZyaiIAXogC--"


xmlHTTP.SetRequestHeader "Content-Length", Len(strData) + 2


'strData = Server.URLEncode(strData)                                        'This is used if content-type=application/x-www-form-urlencoded

xmlHTTP.Send strData