none
HTTP code 203: Non-Authoritative Information RRS feed

  • Question


    I am trying to create work item in visual studio team services using java. but i am getting error "HTTP code 203: Non-Authoritative Information". When the same thing i am trying with C# its working fine. 

    I am attaching both source code using C# and java. please check and let me know why i am getting this error.

    JAVA

    try {
    CloseableHttpClient http = HttpClientBuilder.create().build();
    String encoding = Base64.getEncoder().encodeToString((ACCESS_TOKEN).getBytes("ASCII"));
    HttpGet get = new HttpGet(
    "https://{account}.visualstudio.com/TestProject/_apis/wit/workitems/5?api-version=1.0");
    get.setHeader("Authorization", "Basic " + encoding);
    get.addHeader("content-type", "application/json");
    HttpResponse response = http.execute(get);
    String out = response.getEntity().toString();
    System.out.println(response.getStatusLine().getStatusCode());
    } catch (Exception e) {
    System.out.println(e);
    }

    C#

    try { var personalaccesstoken = "PATFROMWEB"; using (HttpClient client = new HttpClient()) { client.DefaultRequestHeaders.Accept.Add( new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String( System.Text.ASCIIEncoding.ASCII.GetBytes( string.Format("{0}:{1}", "", personalaccesstoken)))); using (HttpResponseMessage response = client.GetAsync( "https://{account}.visualstudio.com/TestProject/_apis/wit/workitems/5?api-version=1.0").Result) { response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); } } } catch (Exception ex) { Console.WriteLine(ex.ToString()); }


    Tuesday, April 10, 2018 5:09 AM

All replies

  • Hi,

    This forum is for Visual Studio IDE, your issue is more about Working with Visual Studio Team Services (VSTS) and Java , however  VSTS(Visual Studio Team Service) community has been moved from MSDN to Developer Community and Stack Overflow, I suggest you post the issue there to get better support.

    Thanks for your understanding.

     

    Regards,

    Fletcher


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    • Edited by Fletch Zhou Wednesday, April 11, 2018 2:06 AM
    Wednesday, April 11, 2018 2:06 AM