0
votes

I am using multi stage pipelines for creating ci,cd. Here I am not getting any releases under release tab. So I am querying all deployments using environment id. See below link for getting deployment records by environment id.

https://docs.microsoft.com/en-us/rest/api/azure/devops/distributedtask/environmentdeployment%20records/list?view=azure-devops-rest-6.0

Now I am looking for client api for above documentation. example for getting classic releases through api Microsoft.VisualStudio.Services.ReleaseManagement.WebApi.

var releases =  releaseClient.GetReleasesAsync(Project, releaseDefinitionId).Result;

Same way I am looking for any web api api available to get deployments using environment id.

1

1 Answers

1
votes

You need to add preview version of assembly Microsoft.TeamFoundation.DistributedTask.WebApi, and use EnvironmentDeploymentExecutionRecord Class, this class is still under preview.

The code would look like example below:

 TaskAgentHttpClient edClient = connection.GetClient<TaskAgentHttpClient>();
 var project = "Git";
 int environmentid = 5;
 var Environmentdeployment = edClient.GetEnvironmentByIdAsync(project, environmentid).Result;