Reputation: 5
I have a problem where if I provide a build id and use 'LIST Release Azure DevOps API' it is fetching all the releases present in that build. But here the problem is that the 'LIST API' is not providing details of the environments present in the list of releases. I need to make another request with the release id to fetch the environment details for every release. Is there any option that will combine both these operations?
Upvotes: 0
Views: 605
Reputation: 30373
You can provide the $expand=environments
parameter in the List release API to include the details of environments in the response result. See here.
https://vsrm.dev.azure.com/{org}/{proj}/_apis/release/releases?sourceId={projectGuid}:{BuildDefinitionId}&$expand=environments&api-version=6.1-preview.8
See below example in powershell scripts:
$url = "https://vsrm.dev.azure.com/{org}/{proj}/_apis/release/releases?sourceId={projectGuid}:{BuildDefinitionId}&`$expand=environments&api-version=6.1-preview.8"
$PAT = "Personal access token"
$base64AuthInfo= [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($PAT)"))
Invoke-RestMethod -Uri $reurl -Headers @{authorization = "Basic $base64AuthInfo"} -Method get
Upvotes: 1