How to call Rest Apis RRS feed

  • Question

  • Hi team,

    Can you please guide us how to integrate rest apis with Team foundation server 2015. To call the rest apis in vsts we have to enable the basic authentication how ever it is possible in vsts to do that,but in case of on prem TFS we couldn't see the option to enable the basic authentication and to provide conditionals .please give your inputs here. 

    Friday, April 15, 2016 6:41 AM


  • Hi yellesh,

    Thank you for posting here.

    This is an example on using TFS REST API to communicate with TFS. For on-premises TFS, you don't need to enable Basic authentication.

        public static async void createtWorkItem()
                string requestUrl = "http://TFS2015servername:8080/tfs/collectionname/teamprojectname/_apis/wit/workitems/$Task?api-version=1.0";
                JavaScriptSerializer serializer = new JavaScriptSerializer();
                string json = serializer.Serialize(new object[]{new
                    op = "add",
                    path = "/fields/System.Title",
                    value = "New Task from TFS 2015 REST API"
                HttpClientHandler authtHandler = new HttpClientHandler()
                   // Credentials = CredentialCache.DefaultNetworkCredentials
                    Credentials = new NetworkCredential("username", "password", "domainname")
                using (HttpClient client = new HttpClient(authtHandler))
                    var method = new HttpMethod("PATCH");
                    var request = new HttpRequestMessage(method, requestUrl)
                        Content = new StringContent(json, Encoding.UTF8,
                    HttpResponseMessage hrm = await client.SendAsync(request);

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Sunday, April 17, 2016 9:31 AM