简体   繁体   中英

Using Azure DevOps REST Api how can I get the build by its build number, except by listing all the builds?

So I see the Api to get the build by its build Id, but I cannot see one to get it by the build number. Is the only way to list all the builds?

您可以在构建中使用可选参数-List API

https://dev.azure.com/{organization}/{project}/_apis/build/builds?api-version=4.0&buildNumber=0.0.1836.3

There is no API for getting a build according to the build number because theoretically, it could be few builds with the same build number, so if you want to retrieve the build according to the build number you need to get all the builds with this Rest API and then filter the results.

For example (with PowerShell):

# Get the results with Invoke-RestMethod
$builds = Invoke-RestMethod ...
$buildNumber = "10.7"
$myBuild = $builds.value.Where({ $_.buildNumber -eq $buildNumber})

this is the call you are looking for:

GET https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}?api-version=5.0

edit: NVM, I misread the question. there is no way to get the build by its build number.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM