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

Request using cURL

curl -H "Authorization: Bearer <API_KEY>" \
     https://HOSTNAME/api/sonar/scheduled-queries

Request Parameters

KeyRequiredTypeDescriptionNote
offsetX32-bit integerNumber of records to skipDefault: 0
limitX32-bit integerMaximum number of records to loadDefault: all
keywordsXStringKeywordsSearch 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_type is set to cron.
    • preceding_guid (String): GUID of preceding query. Required when trigger_type is set to workflow.
    • preceding_name (String): Name of preceding query. Required when trigger_type is set to workflow.
    • preceding_action (String): Preceding query status. Either succeeded, failed, or finished when trigger_type is set to workflow.
    • elapsed_time (32-bit integer): Elapsed time (unit: milliseconds)
    • running_state (String): Query running status. Either running, stopping, finished, or canceled.
    • result_state (String): Query result. Either succeeded, failed, or canceled.
    • 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"
}