Please note that there are multiple ways to interact with an Aria Automation host from Orchestrator, including:
The following sample Javascript code can be used to acquire refresh token in an Orchestrator Action.
This is intended as an illustrative minimal example and does not include any error handling.
var vraHost = "https://<VRA-FQDN>"
// The Automation username can be given without specifying domain in most setups:
var username = "########"
var password = "########"
var creds = '{"username": "' + username + '", "password": "' + password + '"}'
endpoint = vraHost + "/csp/gateway/am/api/login?access_token"
vraRESThost = RESTHostManager.createHost("dynamicRequest")
var vRA = RESTHostManager.createTransientHostFrom(vraRESThost)
vRA.url = vraHost
request = vRA.createRequest("POST", endpoint, creds)
request.setHeader("Content-Type", "application/json")
var response = request.execute()
var result = response.contentAsString
// This result can be parsed as JSON to pull out the refresh token and obtain a bearer token:
System.log(result)
// Close the connection once it is no longer needed
request.setHeader("Connection", "close");