Get Scheduled Queries
Gets a list of the scheduled queries that match the search keyword. Administrator privileges are required to call this API.
HTTP Request
GET /api/sonar/scheduled-queries
cURL Example
curl -H "Authorization: Bearer <API_KEY>" \
https://HOSTNAME/api/sonar/scheduled-queries
Request Parameters
| Key | Required | Type | Description | Note |
|---|---|---|---|---|
| offset | X | 32-bit integer | Number of records to skip | Default: 0 |
| limit | X | 32-bit integer | Maximum number of records to load | Default: all |
| keywords | X | String | Keywords | Search available by name, description, and query string |
Success Response
Below is a partial list of scheduled queries.
{
"total_count": 15,
"scheduled_queries": [
{
"guid": "95e17283-1d08-44f0-bac7-b734813d2dcd",
"name": "test",
"description": "",
"enabled": false,
"node_types": null,
"query": "json \"{}\"",
"output_parameter": false,
"trigger_type": "cron",
"cron_schedule": "* * * * *",
"preceding_guid": null,
"preceding_name": null,
"preceding_action": null,
"running_state": null,
"result_state": null,
"elapsed_time": null,
"last_run_time": null,
"last_failure_time": null,
"last_failure_reason": null,
"created": "2023-09-18 16:12:44+0900",
"updated": "2023-09-18 16:12:44+0900"
}
]
}
- total_count (32-bit integer): total number of the scheduled queries that match the search keyword.
- scheduled_queries (Array): Paged list of scheduled queries that match the search keyword
- guid (String): GUID of the scheduled query
- name (String): Name
- description (String): Description
- enabled (Boolean): Whether the scheduled query is enabled or not
- node_types (Array): Node on which to run the query (
control: control node,data: data node) - query (String): Query string
- output_parameter (Boolean): Whether to pass the last result row as query parameter(s) to the subsequent query
- trigger_type (String): Query trigger (
cron: Run at predefined intervals or on a predetermined schedule,workflow: Run based on the preceding query result) - cron_schedule (String): Cron schedule expression. Required when
trigger_typeis set tocron. - preceding_guid (String): GUID of preceding query. Required when
trigger_typeis set toworkflow. - preceding_name (String): Name of preceding query. Required when
trigger_typeis set toworkflow. - preceding_action (String): Preceding query status. Either
succeeded,failed, orfinishedwhentrigger_typeis set toworkflow. - elapsed_time (32-bit integer): Elapsed time (unit: milliseconds)
- running_state (String): Query running status. Either
running,stopping,finished, orcanceled. - result_state (String): Query result. Either
succeeded,failed, orcanceled. - last_run_time (String): Last run time (
yyyy-MM-dd HH:mm:ssZ) - last_failure_time (String): Last failure time (
yyyy-MM-dd HH:mm:ssZ) - last_failure_reason (String): Query failure reason
- created (String): Creation time (
yyyy-MM-dd HH:mm:ssZ) - updated (String): Last modified time (
yyyy-MM-dd HH:mm:ssZ)
Error Responses
offset or limit value is not an integer
HTTP status code 400
{
"error_code": "invalid-argument",
"error_msg": "'offset' must be greater than or equal to 0."
}
No administrator privileges
HTTP status code 500
{
"error_code": "illegal-state",
"error_msg": "no-permission"
}