title: 400 - Bad Request when performing bulk import of contacts
body: <p>I'm attempting to perform a bulk import using a Multipart content type, although, regardless what I try, I continually get error 400 - Bad Request.  Unfortunately, this doesn't tell me much, and the documentation for <a href="http://developer.constantcontact.com/docs/bulk_activities_api/bulk-activities-addcontact-multipart.html#response-codes" rel="nofollow">bulk importing of contacts</a> only states this error happens when there is an error when validating a contact.  This is the method which I've currently got into place:</p>
  
  <pre><code>public void SendContactFile(string contactListId, FileInfo listFile)
  {
      using (var client = new HttpClient())
      {
          client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken);
          client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
  
          using (var content = new MultipartFormDataContent())
          {
              var contentPieces = new []
              {
                  new KeyValuePair&lt;string, string&gt;("file_name", listFile.Name),
                  new KeyValuePair&lt;string, string&gt;("lists", contactListId), 
              };
              //var data = new StreamContent(listFile.OpenRead()); //I've tried using both StreamContent and ByteArrayContent; both returned the same failure.
              var data = new ByteArrayContent(File.ReadAllBytes(listFile.FullName));
              data.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
              {
                  FileName = listFile.Name
              };//I've tried with &amp; without this header.
  
              foreach (KeyValuePair&lt;string, string&gt; pair in contentPieces)
              {
                  content.Add(new StringContent(pair.Value), pair.Key);
              }
              content.Add(data);
  
              var result = client.PostAsync(FullApiAddress, content).Result;
              Console.WriteLine("Status Code: {0} - {1}, Request Message: {3}", 
                  result.StatusCode, 
                  result.ReasonPhrase,
                  result.RequestMessage);
          }
      }
  }
  </code></pre>
  
  <p>Lastly, the information displayed by my Console.WriteLine() is:</p>
  
  <pre><code>Status Code: BadRequest - Bad Request, 
  Request Message: Method: POST, 
  RequestUri: 'https://api.constantcontact.com/v2/activities/addcontacts?api_key=My_API_Key',
  Content: System.Net.Http.MultipartFormDataContent, 
  Headers:
  {
    Authorization: Bearer My-Access-Token
    Accept: application/json
    Content-Type: multipart/form-data; boundary="ead4e036-5921-4a98-847b-12h4sgre4
  69c"
    Content-Length: 556
  }
  </code></pre>
  
  <p>EDIT</p>
  
  <p>Thanks to Amy's suggestions in the comments below, I've used the Postman extension in Chrome to perform the Bulk Import directly from the browser.  By doing so, I can now rule out file formatting as an possible cause of my error (and have removed those examples), and also know that I'm going about this in the right way.  Therefore, something is not quite right with my code...any ideas from anyone?  </p>
  
  <p>One difference between the in-browser request that was successful and the Headers shown above is that the <code>Content-Type: mulitpart/form-data;</code> has the boundary info with it, whereas the info from the browser had that info on each part.  Also, the code above doesn't show each part.  Example of the Postman request preview:</p>
  
  <pre><code>Content-Type: multipart/form-data
  Cache-Control: no-cache
  
  ----WebKitFormBoundaryE19zNvXGzXaLvS5C
  Content-Disposition: form-data; name="file_name"
  
  ContactList.txt
  ----WebKitFormBoundaryE19zNvXGzXaLvS5C
  Content-Disposition: form-data; name="lists"
  </code></pre>