title: Jira REST API returning HTML
body: <p>I am trying to access the Jira rest API via C#. For that I am using the <code>Windows.Web.Http.HttpClient</code>. But all I get as a return value is HTML.</p>
  
  <p>I am calling the following URL: <code>https://jira.atlassian.com/rest/api/latest/field/</code></p>
  
  <p><strong>Little Edit</strong><br>
  When I call the url from a browser it works fine, just the call from the HttpClient doesn't work.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>public async Task&lt;IRestResponse&gt; Execute(RestRequest request) {
      var restResponse = new RestResponse();
      var client = new HttpClient();
      var req = new HttpRequestMessage(request.Method, new Uri(BaseUrl, UriKind.RelativeOrAbsolute));
      foreach (var item in request.headers) {
          req.Headers[item.Key] = item.Value;
      }
  
      req.Headers.Accept.Add(new HttpMediaTypeWithQualityHeaderValue("application/json"));
      if (this.Authenticator != null)
          req.Headers["Authorization"] = this.Authenticator.GetHeader();
  
      var res = await client.SendRequestAsync(req);
      restResponse.Content = await res.Content.ReadAsStringAsync();
      restResponse.StatusCode = res.StatusCode;
      restResponse.StatusDescription = res.ReasonPhrase;
  
      if (!res.IsSuccessStatusCode) {
          restResponse.ErrorMessage = restResponse.Content;
          restResponse.ResponseStatus = ResponseStatus.Error;
      } else if (res.StatusCode == HttpStatusCode.RequestTimeout) {
          restResponse.ResponseStatus = ResponseStatus.TimedOut;
      } else if (res.StatusCode == HttpStatusCode.None) {
          restResponse.ResponseStatus = ResponseStatus.None;
      } else {
          restResponse.ResponseStatus = ResponseStatus.Completed;
      }
  
      return restResponse;
  }
  </code></pre>