Get Scheduled Query

Retrieves information of a specified scheduled query. Administrator privileges are required to call this API.

HTTP Request

GET /api/sonar/scheduled-queries/:guid

Request using cURL

curl -H "Authorization: Bearer <API_KEY>" \
     https://HOSTNAME/api/sonar/scheduled-queries/95e17283-1d08-44f0-bac7-b734813d2dcd

Request Parameter

KeyRequiredTypeDescriptionNote
guidOStringScheduled query GUID

Success Response

{
  "scheduled_query": {
    "guid": "95e17283-1d08-44f0-bac7-b734813d2dcd",
    "name": "test",
    "description": "",
    "enabled": false,
    "node_types": ["control", "data"],
    "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"
  }
}
  • scheduled_query (Map): Scheduled query
    • 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

Identifier is not in valid GUID format

HTTP status code 400

{
  "error_code": "invalid-param-type",
  "error_msg": "guid should be guid type."
}
Scheduled query is not found

HTTP status code 200

{
  "result": false,
  "error_msg": "scheduled query not found : 0fb16aa8-dbc1-458a-9769-342de5cf9211"
}
No administrator privileges

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "no-permission"
}