You are viewing the documentation of TeamCity 10.x and 2017.x, which is not the most recently released version of TeamCity.
View this page in the latest documentation or refer to the listing to choose the documentation corresponding to your TeamCity version.


Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.



More examples (for TeamCity 8.0) are available in this external posting.



Wiki Markup

Example C# code shared by our users to do REST API calls with NTLM authentication and cookies reuse:

using System;
using System.IO;
using System.Net;

namespace TestingSingleSignOnAuthREST
    class Program
        static void Main(string[] args)
            Console.WriteLine(GetRestResponse("http://teamcity.jetbrains.com", "/app/rest/server"));

        public static string GetRestResponse(string server, string requestStr)
            var cookies = new CookieContainer();
            var request = (HttpWebRequest)WebRequest.Create(server + requestStr);
            request.Timeout = (int)TimeSpan.FromDays(1).TotalMilliseconds;
            request.ContentType = "application/xml";
            request.UseDefaultCredentials = true;
            request.PreAuthenticate = true;
            request.CookieContainer = cookies;

            var resp = request.GetResponse() as HttpWebResponse;
            var reader = new StreamReader(resp.GetResponseStream(), );
            return reader.ReadToEnd();



titleExamples: click to expand

 Get the list of changes for a project: http:// teamcity :8111/app/rest/changes?locator= =project:projectId
http://teamcity:8111/app/rest/changes?locator=buildType:(id:bt133),sinceChange:(id:24234) - to get all the changes in the build configuration since the change identified by the id.


(warning) Note that editing via the TeamCity Web UI will ve disabled for projects created via the REST API