Stored Procedures
Overview
Stored procedures can be executed via the script field in Queries. For example, the following code shows a query where the get_mfa_events.js stored procedure is executed:
POST /redrock/query
{
"Script":"@/lib/get_mfa_events.js",
"Args":{
"PageNumber":1,
"PageSize":100000,
"Limit":100000,
"SortBy":"",
"direction":"False",
"Caching":-1
}
}Stored procedures can also be executed via the script field in in the /JobFlow/StartJob endpoint. For example, the following code shows a query where the server_account_access.js stored procedure is executed as a job:
POST /JobFlow/StartJob
{
"script":"/lib/jobs/server_account_access.js",
"args":{
"PVID":"98765432-1118-4326-815a-d33abd18da26",
"Reason":null,
"AccessType":"Login",
"RequestedOptions":{
"AssignmentType":"window",
"StartTime":"Fri, 02 Feb 2018 20:11:00 GMT",
"EndTime":"Fri, 02 Feb 2018 21:11:00 GMT"
}
}
}Parameters
Some stored procedures take in parameters via an args field in the body and others take in parameters inline with the filename.
The following shows an example of passing multiple parameters via the args field:
POST /redrock/query
{
"Script":"@/lib/email_report.js",
"Args":{
"SelectQuery": "Select ID from VaultAccount where User = \"Administrator\"",
"Parameters":
[
{
"Name" : "TestParam0",
"DisplayValue" : "Test0",
"Value" : "TestValue0",
}
],
"To":"[email protected]",
"Subject": "Test report",
"ReportFormat": "html",
"ReportName" : "MyReport"
}
}Note: the args field may also contain parameters for pagination.
The following shows an example of passing the id parameter inline with the filename:
POST /redrock/query
{
"Script":"@/lib/server/get_activity_for_discoveryprofile.js(id:'b65cef...')"
}Stored Procedures
The following is a list of available stored procedures.
Stored Procedures Executed through /RedRock/Query
Stored Procedures Executed through /JobFlow/StartJob
| Name | Description |
|---|---|
| cps_assign_computer_role | Assigns a computer role. |
| job_history | Gets the history of jobs. |
Updated 10 months ago
