CMDBQueryBuilderAPI - Global
The CMDBQueryBuilderAPI provides methods to retrieve Query Builder saved query execution details in server-side scripts.
To access this API you must activate the Configuration Management (CMDB) (com.snc.cmdb) plugin.
For more information on the CMBD Query Builder, see Querying the CMDB.
CMDBQueryBuilderAPI - getSavedQueryExecutionDetails(String savedQueryName, Boolean executeQuery, Number timeout)
Returns the execution details for a specified Configuration Management Database (CMDB) Query Builder saved query.
Optionally you can specify whether to execute the query or not, in order to return its most recent query execution details. You can also override the default timeout limit for the execution of the query.
In the event of a timeout or memory issue while executing the query, you can fine tune the query batch size to help alleviate these problems. For additional information, see Batch size for Query Builder saved queries.
| Name | Type | Description |
|---|---|---|
| executeQuery | Boolean | Optional. Flag that indicates whether to execute the specified query or
not. Valid values:
Default: False |
| savedQueryName | String | Name of the CMDB Query Builder saved query for which to return query execution details. |
| timeout | Number | Optional. Integer value that overrides the default query execution timeout
limit of five minutes. Unit: Seconds Default: Five minutes |
| Type | Description |
|---|---|
| Error | Error code and message. Returned when the query execution fails or the
specified query is not found. Error examples:
|
| query_id | Saved query Execution ID (sys_id). Obtained from the Query Status [qb_query_status] table. |
| table_name | Name of the table that contains the execution query details. |
| status | Status of the query execution.
|
This example shows how to call the getSavedQueryExecutionDetails() method.
SNC.CMDBQueryBuilderAPI.getSavedQueryExecutionDetails('Test', true);
Output:
{"query_id":"024fd53a7773330033b5270bba106141",
"table_name":"u_cmdb_qb_result_598918aacb4dbf3f1a8dcf03fce6a5d57151a4e2",
"status":COMPLETE}
This example shows how to call the getSavedQueryExecutionDetails() method and override the default query execution timeout value to 10 minutes.
SNC.CMDBQueryBuilderAPI.getSavedQueryExecutionDetails('Test', true, 600);
Output:
{"query_id":"024fd53a7773330033b5270bba106141",
"table_name":"u_cmdb_qb_result_598918aacb4dbf3f1a8dcf03fce6a5d57151a4e2",
"status":COMPLETE}