Reputation: 62886
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?
Upvotes: 2
Views: 2239
Reputation: 41775
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})
Upvotes: 1
Reputation: 4065
You can use an optional parameter on the builds - List API
https://dev.azure.com/{organization}/{project}/_apis/build/builds?api-version=4.0&buildNumber=0.0.1836.3
Upvotes: 5
Reputation: 72191
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.
Upvotes: 0