"Invalid Content Type" when attempting Bulk Leads Import
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", "REDACTED.mktorest.com/bulk/v1/leads.json?format=CSV&lookupField=email&access_token=REDACTED", false
xmlHTTP.setRequestHeader "content-type", "text/csv"
'I have also tried these content-types:
' application/x-www-form-urlencoded
' application/vnd.ms-excel
' 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,ablebaker@marketo.com,Marketo" & vbCrLf
strData=strData & "Charlie,Dog,charliedog@marketo.com,Marketo" & vbCrLf
strData=strData & "Easy,Fox,easyfox@marketo.com,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