App Framework JavaScript library
The App Framework JavaScript library provides helper functions for common QRadar® calls that you can integrate into your own scripts.
The helper functions that are included in the App Framework JavaScript library (app/static/qjslib/qappfw.js) can be used to do the following tasks:
- Get information on the current application, user, item, or selected table rows.
- Open the Details page for an asset.
- Search for an event or flow by using a specified AQL query.
- Open the Details page for an offense.
- Call a REST method by using an XMLHttpRequest.
- Retrieve named services and named service endpoints.
You can view the HTML documentation for the JS library in the jsdoc directory after you unzip the SDK (.zip) file.
The helper functions in the App Framework JavaScript Library are described in the following table:
Function | Description |
---|---|
getApplicationBaseUrl(id) | Returns the base URL of an application. |
getApplicationId() | Returns the ID of the current application. Note:
The functions getApplicationId() and getApplicationBaseUrl (id) depend on a variable called CURRENT_SCOPE, which is injected into the JavaScript context by the app framework when it imports a JavaScript file that is defined in the page_scripts section of an app manifest file. The functions can only be used if you are using the page_scripts mechanism to pull in your custom JavaScript. For example, if you use a script tag in a Jinja template the functions won't work. |
getCurrentUser() | Returns the current user. |
getItemId() | Returns the ID of the item that is viewed (for example, an asset or offense). |
getSelectedRows() | Returns the IDs of selected rows on a list page, such as the offense or asset list. |
openAsset(assetId, openWindow) | Opens the Details page of an asset, either in a new window or in the Assets tab. |
openAssetForIpAddress(ipAddress, openWindow) | Opens the Details page of an asset for an IP address, either in a new window or in the Assets tab. |
openEventSearch(aql, openWindow) | Runs an event search with the specified AQL string, either in a new window or the Event Viewer tab. |
openFlowSearch(aql, openWindow) | Runs a flow search with the specified AQL string, either in a new window or the Flow Viewer tab. |
openOffense(offenseId, openWindow) | Opens the Details page of an offense, either in a new window or in the Offenses tab. |
rest(args) | Calls a REST method by using an XMLHttpRequest. |
buildNamedServiceEndpointRestArgs (restArgs, endpoint, parameterValues, bodyValue) | Populates an arguments object to be used in a QRadar.rest call to a named service endpoint. |
callNamedServiceEndpoint (serviceName, serviceVersion, endpointName, restArgs, parameterValues, bodyValue) | A wrapper function that calls the /gui_app_framework/named_services REST API, selects the specified service endpoint, and invokes it by using the supplied parameters and values. |
getNamedService (services, serviceName, serviceVersion) | Selects and returns a service from a list that is retrieved by a /gui_app_framework/named_services |
getNamedServiceEndpoint (service, endpointName) | Selects and returns a service endpoint. |