RESTful API
The AEO web-server’s base URL consists of the web-server’s name and port number followed by the web plug-in name. Example: https://<servername>:<port>/oc_main/aeo
The plug-in name is configurable and the default value is ‘aeo’.
To perform any operation or access any information from AEO web-server, the client first needs to ‘login’ and use the same login session for further requests.
Documentation
Documentation for the RESTful API can be found under the main menu.
From the page displayed, a list of all api calls is available along with a list of parameters that can be passed to each call.
Use Cases
- The localhost can be the machine hostname or IP address.
- The URL can be https or http based on SSL configuration.
- A Login script is required for executing all the mentioned scripts if it is executed for the first time.
URL: /users/login
REQUEST
PowerShell
$login_url='https://localhost:7980/oc_main/aeoweb/users/login?'
$login = @{
login='UserID'
password='****'
}
$aeo_login = Invoke-RestMethod -Uri $login_url -Method Get -SessionVariable 'Session' -Headers $login
JavaScript
var xhttp = new XMLHttpRequest();
xhttp.open("GET", "https://localhost:7980/oc_main/aeoweb/users/login", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.setRequestHeader("login", "asg\\username");
xhttp.setRequestHeader("password", "****");
xhttp.send();
Bash
curl --cookie-jar /tmp/cookiejar -X
GET "https://localhost:7980/oc_main/aeoweb/users/login?pwd=****&login=asg\\username"
RESPONSE
No output for the Login.
URL: /users
Here, we login to the web server and then submit a request to obtain the list of users from the web server.
REQUEST
PowerShell
#login
$login_url="https://localhost:7980/oc_main/aeoweb/users/login?"
$login = @{
login='ASG\username'
password='****'
}
$aeo_login = Invoke-RestMethod -Uri $login_url -Method Get -SessionVariable 'Session' -Headers $login
#Get Users
$users_url = ‘https://localhost:7980/oc_main/aeoweb/users’
$users = Invoke-RestMethod -Uri $users_url -Method Get -WebSession $Session
Write-Output $users.items;
JavaScript
#login
var xhttp = new XMLHttpRequest();
xhttp.open("GET", "https://localhost:7980/oc_main/aeoweb/users/login", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.setRequestHeader("login", "asg\\username");
xhttp.setRequestHeader("password", "****");
xhttp.send();
#Get Users
var xhr = new XMLHttpRequest();
xhr.open("GET", "https://localhost:7980/oc_main/aeoweb/users", true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.send();
Bash
#login
curl --cookie-jar /tmp/cookiejar -X
GET "https://localhost:7980/oc_main/aeoweb/users/login?pwd=****&login=asg\\username"
#Get Users
$ curl --cookie /tmp/cookiejar --request GET "https://localhost:7980/oc_main/aeoweb/users"
RESPONSE
colorId : 1
id : 12
uid : 8********A
name : TestUser
login : asg\TestUser
modified : 2020.06.04 09.33
created :
enabled : True
enabledStr : YES
allRights : True
allAgents : True
allRightsStr : YES
allAgentsStr : YES
connectCnt : 0
lastLogin : 2020.06.22 05.53
After logging in to AEO web server using the /users/login API, use the /definitions/operation API to run a process in AEO.
REQUEST
PowerShell
#login
$login_url="https://localhost:7980/oc_main/aeoweb/users/login?"
$login = @{
login='ASG\username'
password='****'
}
$aeo_login = Invoke-RestMethod -Uri $login_url -Method Get -SessionVariable 'Session' -Headers $login
#Run Task id 16
$run_url='https://localhost:7980/oc_main/aeoweb/definitions/operation'
$post_body=@{
id='65'
operation='run'
}
Invoke-RestMethod -Uri $run_url -Method Post -Body $post_body -WebSession $Session;
JavaScript
#login
var xhttp = new XMLHttpRequest();
xhttp.open("GET", "https://localhost:7980/oc_main/aeoweb/users/login", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.setRequestHeader("login", "asg\\username");
xhttp.setRequestHeader("password", "****");
xhttp.send();
#Run Task Id 16
var xhr = new XMLHttpRequest();
xhr.open("POST", "https://localhost:7980/oc_main/aeoweb/definitions/16/operation?operation=schedule", true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.send();
Bash
#login
curl --cookie-jar /tmp/cookiejar -X
GET "https://localhost:7980/oc_main/aeoweb/users/login?pwd=****&login=asg\\username"
#Run Task Id 16
curl --cookie /tmp/cookiejar --header "Content-Type: application/json" --request
POST https://localhost:7980/oc_main/aeoweb/definitions/16/operation?operation=schedule
We have scheduled task definition with ‘id=16’ to run on AEO immediately. If the task was run successfully or not can be seen by parsing the response from the web server.
RESPONSE
success message
------- -------
True 1 definitions run
API: /agents
We can get the agents records for all the agents in the scheduler by using this API request.
REQUEST
PowerShell
#login
$login_url="https://localhost:7980/oc_main/aeoweb/users/login?"
$login = @{
login='ASG\username'
password='****'
}
$aeo_login = Invoke-RestMethod -Uri $login_url -Method Get -SessionVariable 'Session' -Headers $login
#Get Agents List
$agents_url='https://localhost:7980/oc_main/aeoweb/agents'
$agent_list=Invoke-RestMethod -Uri $agents_url -Method Get -WebSession $Session;
Write-Output $agent_list.items;
JavaScript
#login
var xhttp = new XMLHttpRequest();
xhttp.open("GET", "https://localhost:7980/oc_main/aeoweb/users/login", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.setRequestHeader("login", "asg\\username");
xhttp.setRequestHeader("password", "****");
xhttp.send();
#Get Agents List
var xhr = new XMLHttpRequest();
xhr.open("GET", "https://localhost:7980/oc_main/aeoweb/agents", true);
xhr.send();
RESPONSE
colorId : 2
id : 1
uid : E*******A
name : JavaAgent Agent Test 41
computer : System1
type : PLATFORM
connected : True
paused : False
version : 4.*.*.**8 (J)
modified : 2020.07.09 13.03
created :
enabled : True
enabledStr : YES
lastConnected : 2020.07.13 03.14
startTime : 2020.07.13 03.13
logLevel : DETAIL
API: /definitions/{id} or /definitions/{uid}
We login into the web server as a user and then using the same session, perform the request to retrieve a definition.
REQUEST
PowerShell
#login
$login_url="https://localhost:7980/oc_main/aeoweb/users/login?"
$login = @{
login='ASG\username'
password='****'
}
$aeo_login = Invoke-RestMethod -Uri $login_url -Method Get -SessionVariable 'Session' -Headers $login
#Get definition with Id 65
$get_definition_url='https://localhost:7980/oc_main/aeoweb/definitions/65';
Invoke-RestMethod -Uri $get_definition_url -Method Get -WebSession $Session;
JavaScript
#login
var xhttp = new XMLHttpRequest();
xhttp.open("GET", "https://localhost:7980/oc_main/aeoweb/users/login", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.setRequestHeader("login", "asg\\username");
xhttp.setRequestHeader("password", "****");
xhttp.send();
#Get definition with Id 78
var xhr = new XMLHttpRequest();
xhr.open("GET", "https://localhost:7980/oc_main/aeoweb/definitions/78", true);
xhr.send();
Bash
#login
curl --cookie-jar /tmp/cookiejar -X
GET "https://localhost:7980/oc_main/aeoweb/users/login?pwd=****&login=asg\\username"
#Get definition with Id 78
curl --cookie /tmp/cookiejar --request
GET "https://localhost:7980/oc_main/aeoweb/definitions/78"
The request has been sent to get the data for the AEO task whose definition Id is 78. The response from the web server is as follows:
RESPONSE
success definition
------- ----------
True @{type=TASK; subType=TASK_EMAIL; id=65; name=Email Task; uid=1*************E; modified=2020.04.21 07....
A definition can also be retrieved using the ‘uid’ of the definition record instead of the definition ‘id’. The following example shows how to retrieve a definition record using its ‘uid’.
REQUEST
PowerShell
#login
$login_url="https://localhost:7980/oc_main/aeoweb/users/login?"
$login = @{
login='ASG\username'
password='****'
}
$aeo_login = Invoke-RestMethod -Uri $login_url -Method Get -SessionVariable 'Session' -Headers $login
#Get definition record using UID
Invoke-RestMethod -Uri "https://localhost:7980/oc_main/aeoweb/definitions/A49FF380986A"
-Method Get -WebSession $Session;
JavaScript
#login
var xhttp = new XMLHttpRequest();
xhttp.open("GET", "https://localhost:7980/oc_main/aeoweb/users/login", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.setRequestHeader("login", "asg\\username");
xhttp.setRequestHeader("password", "****");
xhttp.send();
#Get definition record using UID
var xhr = new XMLHttpRequest();
xhr.open("GET", "https://localhost:7980/oc_main/aeoweb/definitions/A49FF380986A", true);
xhr.send();
Bash
#login
curl --cookie-jar /tmp/cookiejar -X
GET "https://localhost:7980/oc_main/aeoweb/users/login?pwd=****&login=asg\\username"
#Get definition record using UID
curl --cookie /tmp/cookiejar --request
GET "https://localhost:7980/oc_main/aeoweb/definitions/A49FF380986A"
RESPONSE
{
"success":true, "definition":{ "type":"VARIABLE", "id":73,
"name":"First_Time_Requested", "uid": "UNIQUEID" "modified":"2019.01.17 15.00.39",
"enabled":true, "folder":{
"id":14,
"name":"Private",
"uid": "UNIQUEID"
},
"variableType":"SYSTEM", "dataType":"STRING", "value":"\"09:32:37\"", "publishAgent":true
}
}
API: /definitions
PARAMS: search=<search_string>
We had seen examples of retrieving definitions by using their ‘id’ or ‘uid’. To search one or more definitions using their name the following is the url to use:
/definitions?search=<name_attribute_search_string>
The search result will return all the definitions whose ‘name’ matches the search string specified in the url parameter of the request.
REQUEST
PowerShell
#login
$login_url="https://localhost:7980/oc_main/aeoweb/users/login?"
$login = @{
login='ASG\username'
password='****'
}
$aeo_login = Invoke-RestMethod -Uri $login_url -Method Get -SessionVariable 'Session' -Headers $login
#Search for definition with 'name=First_Time_Requested'
Invoke-RestMethod -Uri 'https://localhost:7980/oc_main/aeoweb/definitions?search=Returnoutput' -Method Get -WebSession $Session;
JavaScript
#login
var xhttp = new XMLHttpRequest();
xhttp.open("GET", "https://localhost:7980/oc_main/aeoweb/users/login", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.setRequestHeader("login", "asg\\username");
xhttp.setRequestHeader("password", "****");
xhttp.send();
#Search for definition with ‘name=First_Time_Requested’
var xhr = new XMLHttpRequest();
xhr.open("GET", "https://localhost:7980/oc_main/aeoweb/definitions?search=First_Time_Requested", true);
xhr.send();
Bash
#login
curl --cookie-jar /tmp/cookiejar -X
GET "https://localhost:7980/oc_main/aeoweb/users/login?pwd=****&login=asg\\username"
#Search for definition with ‘name=First_Time_Requested’
curl --cookie /tmp/cookiejar --request
GET https://localhost:7980/oc_main/aeoweb/definitions?search=First_Time_Requested"
We are searching for definitions whose ‘name’ attribute matches ‘First_Time_Requested’.
RESPONSE
total success items
----- ------- -----
1 True {@{id=1276; name=Returnoutput; uid=C185ED7E82FB; displayType=Process; type=PROCESS; subType=; folderId=62; folder= All Definitions; folderPath= All Definitions; folders=62; o...
We have one definition in the array of definition records returned to us. This is the same definition we had retrieved in one of the previous examples with its ‘uid’. This is the definition record for the variable ‘First_Time_Requested’.
Note that there is a difference in the responses for the 2 requests. The search request’s response doesn’t have the ‘value’ attribute of the variable whereas the earlier request using the ‘uid’ got a response which does include the ‘value’ of the variable. To obtain value of variables by using their ‘name’ is a 2 step process. First search using the name and get the response. Then obtain the ‘id’ or ‘uid’ from the response and then again using that ‘id/uid ‘ make another GET request(/definitions/id or /definitions/uid) to obtain the complete definition record from which the ‘value’ of the variable can be retrieved.
The search parameter in the request url can be used as a wild card search string to retrieve more than one definitions which match the search criteria. The following example shows searching for definitions whose ‘name’ attribute contains the characters ‘Time_Requested’.
REQUEST
PowerShell
#login
$login_url="https://localhost:7980/oc_main/aeoweb/users/login?"
$login = @{
login='ASG\username'
password='****'
}
$aeo_login = Invoke-RestMethod -Uri $login_url -Method Get -SessionVariable 'Session' -Headers $login
#search for definitions matching string "Time_Requested"
Invoke-RestMethod -Uri 'https://localhost:7980/oc_main/aeoweb/definitions?name=Returnoutput' -Method Get -WebSession $Session;
JavaScript
#login
var xhttp = new XMLHttpRequest();
xhttp.open("GET", "https://localhost:7980/oc_main/aeoweb/users/login", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.setRequestHeader("login", "asg\\username");
xhttp.setRequestHeader("password", "****");
xhttp.send();
#Search for definitions matching string "Time_Requested"
var xhr = new XMLHttpRequest();
xhr.open("GET", "https://localhost:7980/oc_main/aeoweb/definitions?search=Time_Requested", true);
xhr.send()
Bash
#login
curl --cookie-jar /tmp/cookiejar -X GET
"https://localhost:7980/oc_main/aeoweb/users/login?pwd=****&login=asg\\username"
#Search for definitions matching string "Time_Requested"
curl --cookie /tmp/cookiejar --request GET
"https://localhost:7980/oc_main/aeoweb/definitions?search=Time_Requested"
RESPONSE
total success items
----- ------- -----
1617 True {@{id=1; name=Weekdays; uid=8DAA2A7991; displayType=Calendar; type=CALENDAR; subType=; folderId=1; folder=Calendars; folderPath=Calendars; folders=1; owner=test.user...
The response shows a JSON array of definition items whose ‘name’ matches the search string.
API: /definitions/{id}/operation
Params: operation=<operation>
In the following example we show how to schedule a process to run while passing a variable to it. We are scheduling definition with ‘id=16’ to run as a process immediately and also pass the variable ‘SLEEP_TIMER’ with value ‘12’. In the post body we specify the name and value of the variable ‘SLEEP_TIMER’ to be used by the process.
REQUEST
PowerShell
#login
$login_url="https://localhost:7980/oc_main/aeoweb/users/login?"
$login = @{
login='ASG\username'
password='****'
}
$aeo_login = Invoke-RestMethod -Uri $login_url -Method Get -SessionVariable 'Session' -Headers $login
#Run process with variable "SLEEP_TIMER" passed in
$post_body={
variables: [{name: "SLEEP_TIMER", value: "12", type: "NUMBER"}]
}
Invoke-RestMethod -Uri 'https://localhost:7980/oc_main/aeoweb/definitions/65/operation?operation=schedule' -Method Post -Body $post_body -WebSession $Session;
JavaScript
#Login
var xhttp = new XMLHttpRequest();
xhttp.open("GET", "https://localhost:7980/oc_main/aeoweb/users/login",
true); xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.setRequestHeader("login", "asg\\userid");
xhttp.setRequestHeader("password", "****");
xhttp.send();
#Run Process while passing a variable
var xhr = new XMLHttpRequest();
xhr.open("POST", "https://localhost:7980/oc_main/aeoweb/definitions/16/operation?operation=schedule", true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.send(JSON.stringify({
variables: [{name: "SLEEP_TIMER", value: "12", type: "NUMBER"}]
}));
Bash
#login
curl --cookie-jar /tmp/cookiejar -X GET "https://localhost:7980/oc_main/aeoweb/users/login?pwd=****&login=asg\\username"
#Run process while passing a variable
$ post_body='{variables:[{name:"SLEEP_TIMER",value:"12",type:"NUMBER"}]}'
$ curl --cookie /tmp/cookiejar --request POST --data $post_body
"https://localhost:7980/oc_main/aeoweb/definitions/16/operation?operation=schedule"
RESPONSE
success message
------- -------
True 1 definitions run
API: /reports/{id}
In the following example we show how to run a report. We are running a report with ‘id=26’.
REQUEST
PowerShell
#login
$login_url="https://localhost:7980/oc_main/aeoweb/users/login?"
$login = @{
login='ASG\username'
password='****'
}
$aeo_login = Invoke-RestMethod -Uri $login_url -Method Get -SessionVariable 'Session' -Headers $login
#Run report
Invoke-RestMethod -Uri 'https://localhost:7980/oc_main/aeoweb/reports/596' -Method Get -WebSession $Session;
JavaScript
#Login
var xhttp = new XMLHttpRequest();
xhttp.open("GET", "https://localhost:7980/oc_main/aeoweb/users/login",
true); xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.setRequestHeader("login", "asg\\userid");
xhttp.setRequestHeader("password", "****");
xhttp.send();
#Run report
var xhr = new XMLHttpRequest();
xhr.open("GET", "https://localhost:7980/oc_main/aeoweb/reports/26", true);
xhr.setRequestHeader('Content-Type', 'application/json');
}));
Bash
#login
curl --cookie-jar /tmp/cookiejar --request GET
"https://localhost:7980/oc_main/aeoweb/users/login?pwd=****&login=asg\\username"
#Run report
$ curl --cookie /tmp/cookiejar --request GET
"https://localhost:7980/oc_main/aeoweb/reports/26"
RESPONSE
total success items
----- ------- -----
16 True {@{ID=1; UID=617922FB51BF; NAME=TEST USER; LOGON=TEST.USER; ROLES=All Rights; MODIFIED=2020.05.10 12.49; ENABLED=YES; EMAIL=; ALLAGENTS=YES; ALLRIGHTS=YES...
API: /scheduler/state
PARAMS: state=pause
REQUEST
PowerShell
#login
$login_url="https://localhost:7980/oc_main/aeoweb/users/login?"
$login = @{
login='ASG\username'
password='****'
}
$aeo_login = Invoke-RestMethod -Uri $login_url -Method Get -SessionVariable 'Session' -Headers $login
#Pause Scheduler
$func_url = 'https://localhost:7980/oc_main/aeoweb/scheduler/state';
$params = @{
state = 'pause'
}
$contentType = "application/x-www-form-urlencoded; charset=UTF-8"
$result = Invoke-RestMethod -Uri $func_url -ContentType $contentType -Method Put -Body $params -WebSession $Session;
Write-Output $result.success;
Bash
#login
curl --cookie-jar /tmp/cookie.txt --request GET "https://localhost:7980/oc_main/aeoweb/users/login?pwd=****&login=asg\\username"
#Pause Scheduler
curl --cookie /tmp/cookie.txt --request PUT https://localhost:7980/oc_main/aeoweb/scheduler/state?state=pause
RESPONSE
True
API: /scheduler/state
PARAMS: state=resume
REQUEST
PowerShell
#login
$login_url="https://localhost:7980/oc_main/aeoweb/users/login?"
$login = @{
login='ASG\username'
password='****'
}
$aeo_login = Invoke-RestMethod -Uri $login_url -Method Get -SessionVariable 'Session' -Headers $login
#Resume Scheduler
$func_url = 'https://localhost:7980/oc_main/aeoweb/scheduler/state';
$params = @{
state = 'resume'
}
$contentType = "application/x-www-form-urlencoded; charset=UTF-8"
$result = Invoke-RestMethod -Uri $func_url -ContentType $contentType -Method Put -Body $params -WebSession $Session;
Write-Output $result.success;
Bash
#login
curl --cookie-jar /tmp/cookie.txt --request GET "https://localhost:7980/oc_main/aeoweb/users/login?pwd=****&login=asg\\username"
#Pause Scheduler
curl --cookie /tmp/cookie.txt --request PUT https://localhost:7980/oc_main/aeoweb/scheduler/state?state=resume
RESPONSE
True
API: /tasks
Params: listdate=<yyyy.mm.dd> (required)
status=<status> (optional)
defId=<definition id> (optional)
The following example shows how to retrieve a list of completed tasks for 08/18/2020. Valid statuses are scheduled, waiting, active, completed, cancelled, and erred. You can optionally specify a task definition ID to have it return only tasks of that type.
REQUEST
Bash
#login
curl --cookie-jar ~/cookiejar --request GET "https://localhost:7980/oc_main/aeoweb/users/login?pwd=****&login=asg\\username"
#Change Alert status
$processId=2450
$status=CLOSED
curl --cookie ~/cookiejar --request PUT "https://localhost:7980/oc_main/aeoweb/alerts/status?processId=${processId}&status=${status}¬es=Closed_Alert"
PowerShell
#login
$login_url = "https://localhost:7980/oc_main/aeoweb/users/login?";
$login = @{
login='ASG\username'
password='****'
}
$aeo_login = Invoke-RestMethod -Uri $login_url -Method Get -SessionVariable 'Session' -Headers $login
$processid = 2450
$status = "CLOSED"
$func_url = "https://localhost:7980/oc_main/aeoweb/alerts/status?processId=$($processid)&status=$($status)¬es=Closed Alert"
$result = Invoke-RestMethod -Uri $func_url -Method Put -WebSession $Session;
Write-Output $result.message
JavaScript
#login
var xhttp = new XMLHttpRequest();
xhttp.open("GET", "http://localhost:7980/oc_main/aeoweb/users/login", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.setRequestHeader("login", "asg\\username");
xhttp.setRequestHeader("password", "****");
xhttp.send();
#Get list of completed tasks on 08/18/2020
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://localhost:7980/oc_main/aeoweb/tasks?listdate=2020.08.18&status=completed", true);
xhr.send();
API: /alerts/status?
Params: processId=<run id of the process>
status=<ACKNOWLEDGED or CLOSED>
notes=<user defined notes>
In the following example, all alerts generated by the run process 2450, will be closed with the note "Closed Alert."
Powershell
$login_url = "https://localhost:7980/oc_main/aeoweb/users/login?"
$login = @{
login='ASG\username'
password='****'
}
$aeo_login = Invoke-RestMethod -Uri $login_url -Method Get -SessionVariable 'Session' -Headers $login
$processid = 2450
$status = "CLOSED"
$func_url = "https://localhost:7980/oc_main/aeoweb/alerts/status?processId=$($processid)&status=$($status)¬es=Closed Alert"
$result = Invoke-RestMethod -Uri $func_url -Method Put -WebSession $Session;
Write-Output $result.message
Javascript
#login
var xhttp = new XMLHttpRequest();
xhttp.open("GET", "https://localhost:7980/oc_main/aeoweb/users/login", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.setRequestHeader("login", "asg\\username");
xhttp.setRequestHeader("password", "****");
xhttp.send();
#Change Alert status
var xhr = new XMLHttpRequest();
xhr.open("PUT", "https://localhost:7980/oc_main/aeoweb/alerts/status?processId=2450&status=CLOSED¬es=Closed_Alert", true);
xhr.send();
Bash
#login
curl --cookie-jar ~/cookiejar --request GET "https://localhost:7980/oc_main/aeoweb/users/login?pwd=****&login=asg\\username"
#Change Alert status
$processId=2450
$status=CLOSED
curl --cookie ~/cookiejar --request PUT "https://localhost:7980/oc_main/aeoweb/alerts/status?processId=${processId}&status=${status}¬es=Closed_Alert"