title: Get response in JSON from API
body: <p>I am using HttpClient to consume an external API from an ASP.NET Web API controller. I am not using authentication, just a token, so I have:</p>
  
  <pre><code>using (var httpClient = new HttpClient()) {
  
    httpClient.DefaultRequestHeaders.Accept.Clear();
  
    httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
  
    HttpResponseMessage response = await httpClient.GetAsync(endpoint);
  
  }
  </code></pre>
  
  <p>I am getting the response always in XML format but I am sending header with "application/json".</p>
  
  <p>Am I missing something it this is a problem with the external API?</p>
  
  <p>What else can I try to get the response in JSON?</p>