TeamCity 2020.2 Help

Get Build Status Icon

This article lists REST API requests concerning build status icons.

An .svg icon (recommended)

GET http://<TeamCity Server host>:<port>/app/rest/builds/<buildLocator>/statusIcon.svg

A .png icon

GET http://<TeamCity Server host>:<port>/app/rest/builds/<buildLocator>/statusIcon

Icon that represents build status for several builds (since TeamCity 10.0)

GET request and strob build locator dimension.

Example request:

For project with the PROJECT_ID ID:

GET http://<TeamCity Server host>:<port>/app/rest/builds/aggregated/strob:(buildType:(project:(id:PROJECT_ID)))/statusIcon.svg

For all active branches in a build configuration with the BUILD_CONF_ID ID:

GET http://<TeamCity Server host>:<port>/app/rest/builds/aggregated/strob:(branch:(buildType:(id:BUILD_CONF_ID),policy:active_history_and_active_vcs_branches),locator:(buildType:(id:BUILD_CONF_ID)))/statusIcon.svg

For request /app/rest/builds/aggregated/<build locator> the status is calculated by list of the builds: app/rest/builds?locator=<build locator>. This allows embedding a build status icon into any HTML page with a simple img tag:

For build configuration with the BUILD_CONF_ID ID:

Status of the last build:

<img src="http://<TeamCity Server host>:<port>/app/rest/builds/buildType:(id:BUILD_CONF_ID)/statusIcon"/>

Status of the last build tagged with the myTag tag:

<img src="http://<TeamCity Server host>:<port>/app/rest/builds/buildType:(id:BUILD_CONF_ID),tag:myTag/statusIcon"/>

BuildSuccessfulStatus.png

All other build locators are supported.

For example, you can use the following markdown markup to add the build status for GitHub repository for the build configuration with ID TeamCityPluginsByJetBrains_TeamcityGoogleTagManagerPlugin_Build and server https://teamcity.jetbrains.com with guest authentication enabled:

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

If the returned image contains "no permission to get data" text (no-permission-to-get-data.png), ensure that one of the following is true:

  • 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.

  • You are logged in to the TeamCity server in the same browser and you have permissions to view the build configuration referenced. Note that this will not help for embedded images in GitHub pages as GitHub retrieves the images from the server side.

Last modified: 25 January 2021