2

I am trying to get the result of a Azure DevOps build i.e Succeeded / Failed via the REST API, so that I can use the result to queue the next build or not.

I have used the below powershell script to get the build details. But the status only provides the information if the build 'Completed' or not, we do not get the information if the build succeeded or not.

$Urinew = "https://<Org>/<project>/_apis/build/builds/"
$Uri2 = $Urinew+$buildId+"?api-version=5.0"
$responseFromGet = Invoke-RestMethod -Method Get -ContentType application/json -Uri $Uri2 -Headers @{Authorization=("Basic {0}" -f $base64authinfo)}
Write-host $responseFromGet
$status = $responseFromGet.status

I have tried to use this link to get the build result. Tried to get the build definition too, but that also does not provide the information of the build Result. I tried the logs too, again same issue. Any help is appreciated.

1 Answer 1

2

The status is what the current status of the build (in progress, completed etc. ), the result status is in the property result , check your responseFromGet.result.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.