Search code examples
azureazure-devopscontinuous-deliveryazure-deployment

Getting the successful deployments between dates or onbefore


I am using the below API to get the successful deployment of a particular pipeline. I am not able to get the deployments happened between particular dates or before particular date.

I tried like below but not getting desired outputs any modification to the below API

Documentation can be found here (https://learn.microsoft.com/en-us/rest/api/azure/devops/release/deployments/list?view=azure-devops-rest-6.0#releasequeryorder)

https://vsrm.dev.azure.com/ABC/DEF/_apis/release/deployments?definitionId=111&sourceBranch=master&createdOn=2022-10-06


Solution

  • Based on your requirement, you need to get the deployments between particular dates or before particular date.

    You need to use the parameter: minStartedTime and maxStartedTime to replace the CreatedOn to set the date .

    For example:

    Between particular dates

    Rest API: use minStartedTime and maxStartedTime

    Get https://vsrm.dev.azure.com/{OrganizationName}/{ProjectName}/_apis/release/deployments?definitionId=xx&minStartedTime=2022-02-01&maxStartedTime=2022-02-17&api-version=6.0
    

    Before particular date use maxStartedTime

    Get https://vsrm.dev.azure.com/{OrganizationName}/{ProjectName}/_apis/release/deployments?definitionId=xx&maxStartedTime=2022-02-17&api-version=6.0
    

    For more detailed info, you can refer to this doc: Deployments - List