Inputs:-
deploymentId - string
vraHost - REST:Host
leasedate - String (example - "2023-04-12T12:45:00.000Z")
Code:-
var restClient = vraHost.createRestClient();
url = "/deployment/api/deployments/"+deploymentId+"/requests"
body = {
"actionId": "Deployment.ChangeLease",
"inputs": {
"Lease Expiration Date": leasedate
}
}
var bodyParameters = JSON.stringify(body)
requestType = "POST"
var request = restClient.createRequest(requestType, url ,bodyParameters);
request.setHeader("Content-Type", "application/json")
var response = restClient.execute(request);
statusCodeAttribute = response.statusCode;
System.log(response.contentAsString)
System.log("REST Response Status Code: " + statusCodeAttribute);
content = JSON.parse(response.contentAsString)
System.log("Request id for action is : " + content.id)
requestId = content.id