In Azure DevOps, I have a CI pipeline which generates an artifact. As soon as the Pull Request gets approved, it triggers a release pipeline. In the release pipeline, I have added a PowerShell task to perform some REST API functions. I am trying to get all the work items associated with this release. and for that i used below api but i get page not found. Can anyone direct me to the correct api which needs to be called in order to get the workitems associated with my release pipeline.
/_apis/Release/releases/$releaseid/workitems?api-version=6.0
here is the powershell snippet which i am trying to call, here release id is called by defining the predefined variable in powershell task in release pipeline
Function GET-WORKRELEASE{
$AzureDevOpsPAT = "wiosoqn4x66brkkcntesttesttesta"
$OrganizationName = "thru"
$AzureDevOpsAuthenicationHeader = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$($AzureDevOpsPAT)")) }
$orz = "https://dev.azure.com/$($OrganizationName)/thru"
$d=''
$uriAccount = $orz + "/_apis/Release/releases/$releaseid/workitems?api-version=6.0"
$responsewe = Invoke-RestMethod -Uri $uriAccount -Method get -Headers $AzureDevOpsAuthenicationHeader
$d1 = $responsewe.value | ConvertTo-Json
write-host $d1
}