Reputation: 2041
In the Web interface of VSTS it is possible to approve the deployment of a release and defer the moment that the deployment is actually done.
This option is however not documented for the REST API. Would it be possible to accomplish this through the REST API?
Upvotes: 0
Views: 875
Reputation: 2041
The way to do this is by setting a scheduled time/date on the Environment before the approval is given.
Get the environment ID by requesting the Release details with the following request:
**GET**
https://[account].vsrm.visualstudio.com/DefaultCollection/[project]/_apis/release/releases/[releaseId]?api-version=3.0-preview.2
In the response there is an array 'environments' which holds the target environments and their respective Ids (property 'id').
Next do a patch for the relevant environment, using the ID obtained before:
**PATCH**
https://[account].vsrm.visualstudio.com/DefaultCollection/[project]/_apis/release/releases/[releaseId]/environments/[environmentId]?api-version=3.0-preview.2
Headers:
Content-Type: application/json
Body:
{
"scheduledDeploymentTime": "2017-12-03T23:30:00Z"
}
Now do the approval, and in the web interface you will see that the deployment has been deferred to the date/time that was set with the above call.
Upvotes: 2