TeamCity REST API Reference 2023.05 Help

Get Build Status Icon

In this article, we explore methods available for build status icons (such as Badge build successful or Badge build failed).

Get Status Icon for Specific Build

To get an .svg icon (recommended approach), use:

/app/rest/builds/<buildLocator>/statusIcon

where buildLocator is a BuildLocator entity.

To get a .png icon, use:

/app/rest/builds/<buildLocator>/statusIcon.png

Get Status Icons for Multiple Builds

To get status icons of multiple builds, use the /app/rest/builds/aggregated endpoint and the strob locator dimension.

For example, to get an icon summarizing build statuses under the MyProject project, use:

/app/rest/builds/aggregated/strob:(buildType:(project:(id:MyProject)))/statusIcon

For an icon representing the latest builds on active branches of the MyBuildConfiguration configuration, use:

/app/rest/builds/aggregated/strob:(branch:(buildType:(id:MyBuildConfiguration),policy:active_history_and_active_vcs_branches),locator:(buildType:(id:MyBuildConfiguration)))/statusIcon

Get Icon for Latest Tagged Build

To fetch an icon of a MyBuildConfiguration build tagged with the MyTag tag, use:

/app/rest/builds/buildType:(id:MyBuildConfiguration),tag:MyTag/statusIcon

Get Icon for Build Run on Specific Branch

To get a status icon of a MyBuildConfiguration build run on the MyBranch branch, use:

/app/rest/builds/buildType:(id:MyBuildConfiguration),branch:MyBranch/statusIcon

Display Build Status in GitHub Readme

If guest access is enabled on your TeamCity server, you can use the following markup to display the status of the TeamCityPluginsByJetBrains_TeamcityGoogleTagManagerPlugin_Build build configuration in your GitHub repository README:

[![Build status](https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:TeamCityPluginsByJetBrains_TeamcityGoogleTagManagerPlugin_Build)/statusIcon](https://<teamcity_server_address>/viewType.html?buildTypeId=TeamCityPluginsByJetBrains_TeamcityGoogleTagManagerPlugin_Build)

Troubleshooting

If the returned image contains the "no permission to get data" text (no-permission-to-get-data.svg), check the following:

  • The server has the guest user access enabled, and the guest user has permissions to access the build configuration referenced. OR

  • The build configuration referenced has the "enable status widget" option ON.

Last modified: 16 May 2023