I'm exploring Bulk Import via the REST API and can successfully post an import through Postman. When I try to use the code snippet from Postman, I get the following error: "{\"requestId\":\"1b0d#16875fb3c42\",\"success\":false,\"errors\":[{\"code\":\"1003\",\"message\":\"Empty file\"}]}" The code is below: if (File.Exists(Path.Combine(folderName, fileName))) { var client = new RestClient(host + "/bulk/v1/leads.json?format=csv&access_token=" + getToken()); var request = new RestRequest(Method.POST); request.AddHeader("cache-control", "no-cache"); request.AddHeader("Content-Type", "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"); //C:\\MarketoBulkImport\\import.csv is hard-coded below, but it is the same file path as what's being checked in the above File.Exists request.AddParameter("multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW", "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"file\"; filename=\"C:\\MarketoBulkImport\\import.csv\"\r\nContent-Type: text/csv\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--", ParameterType.RequestBody); IRestResponse response = client.Execute(request); return response.ToString(); } else { return "file doesn't exists"; }
... View more