2
votes

I am trying to find a list of all branches for a given project. Is it possible to get this information through Teamcity REST API? I found a different answer showing how to get a list of branches for a given build configuration:

Can you use the team city rest api to fetch plan branch names?

But this way I would have to run the query for all build configurations under given project.

However TeamCity has a concept of "active" branches on a given project. I am wondering if it is possible to fetch exactly that.

2

2 Answers

3
votes

Actually, it is possible now.

Implemented for 2017.1 as an experimental features:

  • listing of the branches for a project (merged list of all project's build configuration's branches) via .../app/rest/projects/XXX/branches?locator=policy:XXX
  • additional branch node fields: "active", "lastActivity" timestamp, "builds" (with locator), available via "fields" parameter of the request
  • added "branches" into buildType node, available only via "fields" parameter of the request

Source: https://youtrack.jetbrains.com/issue/TW-44148#comment=27-2018515

I'm using exactly this url: http://TCSERVERADDRESS/app/rest/projects/PROJECTNAME/branches and it works good for me.

1
votes

TeamCtiy REST API does not support showing active branches now. You are welcome to drop a feature request in the tracker