简体   繁体   English

使用Azure DevOps REST Api,除列出所有内部版本外,如何通过内部版本号获取内部版本?

[英]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. 因此,我看到Api通过其构建ID获取该构建,但是我看不到一个通过其构建编号获取它的构建。 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. 没有API可以根据内部版本号获取内部版本,因​​为从理论上讲,可能只有很少的具有相同内部版本号的内部版本,因​​此,如果要根据内部版本号检索内部版本,则需要使用 Rest来获取所有内部版本API,然后过滤结果。

For example (with PowerShell): 例如(使用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. 编辑:NVM,我误解了问题。 there is no way to get the build by its build number. 无法通过其内部版本号获取内部版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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