title: "Response status code does not indicate success: 500 (Internal Server Error)" while creating Test Suite through TFS Rest API
body: <p>While trying to create a <code>Test Suite</code> using <code>TFS 2017 REST API</code>, I am getting the error: </p>
  
  <blockquote>
    <p>System.Net.Http.HttpRequestException - Response status code does not
    indicate success: 500 (Internal Server Error)</p>
  </blockquote>
  
  <p>Code I tried:</p>
  
  <pre><code>using (var client = new HttpClient())
  {
      client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
  
      string base64StringPat = Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes(string.Format("{0}:{1}", "", Configs.Pat)));
      AuthenticationHeaderValue authHeader = new AuthenticationHeaderValue("Basic", base64StringPat);
      client.DefaultRequestHeaders.Authorization = authHeader;
  
      string url = "http://vmctp-tl-mtm:8080/tfs/DefaultCollection/SgkProject/_apis/test/Plans/7/Suites/8?api-version=1.0";
      var content = new StringContent("{\"suiteType\":\"StaticTestSuite\",\"name\":\"Module1\"}", Encoding.UTF8, "application/json");
      using (HttpResponseMessage response = client.PostAsync(url, content).Result)
      {
          response.EnsureSuccessStatusCode();
          string responseBody = await response.Content.ReadAsStringAsync();
          Console.WriteLine(responseBody);
      }
  }
  </code></pre>
  
  <p>I have used this documentation from Microsoft to call the API: <a href="https://www.visualstudio.com/en-us/docs/integrate/api/test/suites#create-a-test-suite" rel="noreferrer">Create a test suite</a></p>
  
  <p>Please guide me in fixing the issue.</p>