You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Rest API for restart service is not working

Summary:

Below groovy rule is running fine, but the services are not getting restarted, i have tried with both v1 & v2 versions but rule ran fine but services didnt restart.

Same username pwd able to restart services through epm automate.

/*Groovy Rule*/

def connection = operation.application.getConnection("EDM")

def body = [
comment: "Restart by Admin using REST API"
]

def response = connection
.post("/interop/rest/v2/config/services/reset")
.header("Content-Type", "application/json")
.body(JsonOutput.toJson(body))
.asString()

println "HTTP Status : ${response.status}"
println "Response : ${response.body}"

if(response.status == 200 || response.status == 202){
println "Restart request submitted."
} else {
throwVetoException("Restart failed. Status=${response.status}\n${response.body}")

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!