In Release Management UI, we show a nice list of work items that are getting deployed as part of a deployment on an environment. In this post, I will talk about how you can get the equivalent list of work items programmatically.
Let us take an example where I have a release (with name RM_M136.9 ) that I want to deploy on my environment (with name R2_WEU1). For this release, here are the work items that you see in the UI.
Before we try to find out the same list using RM APIs, let us get the releaseId for release RM_M136.9 and environmentId for environment R2_WEU1.
- To get the release id, open the release and take the releaseId from the URL https://mseng.visualstudio.com/VSOnline/_releaseProgress?releaseId=4630482&_a=release-pipeline-progress”.
- To get the environment id, open the release definition, click on the environment and take the environmentId from the URL. https://mseng.visualstudio.com/VSOnline/_releaseDefinition?definitionId=17&_a=definition-tasks&environmentId=2461.
Now that we have both these Ids, let us use RM APIs to get the same work item list.
1. First of all, get the last deployed release on an environment. To do that, you can do that using this rest API and the response will contain the last deployed releaseId.
Example: - The response had releaseId 4580686 when following call was made.
2. Now get the work items between the release that you are about to deploy and the above found base release. To do that, use the following rest API which will return you the list of work items.
Example: - The response had following workItem Ids when this call was made.
Please try this out and do let us know in case it does not work for you.