mark
mark

Reputation: 62722

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?

Upvotes: 2

Views: 2204

Answers (3)

Shayki Abramczyk
Shayki Abramczyk

Reputation: 41545

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

Matt
Matt

Reputation: 4035

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

4c74356b41
4c74356b41

Reputation: 72171

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

Related Questions