columnMappingsJSONArray.Add(new JObject( new JProperty("ignored", false), new JProperty("columnName", "email"), new JProperty("idColumnType", "HUBSPOT_ALTERNATE_ID"), new JProperty("propertyName", "email"), new JProperty("foreignKeyType", null), new JProperty("columnObjectType", "CONTACT"), new JProperty("associationIdentifierColumn", false) ));
columnMappingsJSONArray.Add(new JObject( new JProperty("ignored", false), new JProperty("columnName", "firstname"), new JProperty("idColumnType", "null"), new JProperty("propertyName", "firstname"), new JProperty("foreignKeyType", null), new JProperty("columnObjectType", "CONTACT"), new JProperty("associationIdentifierColumn", false) ));
columnMappingsJSONArray.Add(new JObject( new JProperty("ignored", false), new JProperty("columnName", "lastname"), new JProperty("idColumnType", "null"), new JProperty("propertyName", "lastname"), new JProperty("foreignKeyType", null), new JProperty("columnObjectType", "CONTACT"), new JProperty("associationIdentifierColumn", false) ));
JArray filesJSONArray = new JArray();
filesJSONArray.Add(new JObject( new JProperty("fileName", "API_Import_1.csv"), new JProperty("fileImportPage", new JObject( new JProperty("hasHeader", false), new JProperty("columnMappings", columnMappingsJSONArray) ) ) ) );
JObject importRequestJSON = new JObject( new JObject( new JProperty("name", "API_Import_1"), new JProperty("files", filesJSONArray) ) );
var uriRequest = new Uri(importURL + urlParameters);
var myHttpClient = new HttpClient();
ByteArrayContent byteContent = new ByteArrayContent(bytes); byteContent.Headers.Add("Content-Type", "application/octet-stream");
StringContent stringContentImportRequest = new StringContent( importRequestJSON.ToString(), System.Text.Encoding.UTF8, "application/json");
StringContent stringContentFiles1 = new StringContent( filesJSON.ToString());
MultipartFormDataContent multipartContent = new MultipartFormDataContent(); multipartContent.Add(stringContentImportRequest, "importRequest"); multipartContent.Add(byteContent, "files", "API_Import_1.csv");
var response = await myHttpClient.PostAsync(uriRequest.ToString(), multipartContent);