0
votes

Is there an ADO Rest API which let me to query the "currently deployed" release id of a release definition?

I tried to look in https://docs.microsoft.com/en-us/rest/api/azure/devops/release/?view=azure-devops-rest-6.1, but I only find a call to list all release. I am look for the one which is currently deployed.

2

2 Answers

0
votes

You don't need to use Rest API for this purpose.

You can just query the pre-defined variable Release.ReleaseId:

The identifier of the current release record.

Example: 118

0
votes

You can check out Deployments - List rest api to get the currently deployed release id.

You can use the query parameters to query the currently deployed release id of a specific stage of a specific release pipeline.

See below example: Using additional parameters definitionId,deploymentStatus,definitionEnvironmentId(ig.stage id.),$top

`https://vsrm.dev.azure.com/org/proj/_apis/release/deployments?definitionId=3&deploymentStatus=succeeded&definitionEnvironmentId=5&$top=1&api-version=6.1-preview.2`

Note: You can get the definitionId, definitionEnvironmentId from the url of the releae pipeline.

enter image description here

If you are using powershell script to call above rest api. You need to escape the $ in $top parameter by adding a back tick "`$top".