Update Scheduled Query

Updates a specified scheduled query. Administrator privileges are required to call this API.

Required Permissions

Requires the ADMIN role or higher.

HTTP Request

PUT /api/sonar/scheduled-queries/:guid
cURL Example
curl -H "Authorization: Bearer <API_KEY>" \
     -d name="test" \
     -d query="table duration=1m sonar_cpu_logs | search idle <= 10" \
     -d type="cron" \
     -d cron_schedule="* * * * *" \
     -X PUT https://HOSTNAME/api/sonar/scheduled-queries/95e17283-1d08-44f0-bac7-b734813d2dcd
Request Parameters
Path Parameters
KeyTypeDescriptionNote
guidStringScheduled query GUID
Request Body Parameters
KeyRequiredTypeDescriptionNote
nameYesStringNameMaximum 255 characters
descriptionNoStringDescriptionMaximum 2,000 characters
enabledNoBooleanWhether the scheduled query is enabled or notDefault: false
queryYesStringQuery string
trigger_typeYesStringQuery trigger typeEither cron(Run at predefined intervals or on a predetermined schedule) or workflow(Run based on the preceding query result)
cron_scheduleYesStringCron schedule expressionRequired when trigger_type is set to cron.
preceding_guidNoStringGUID of preceding queryRequired when trigger_type is set to workflow.
preceding_actionNoStringPreceding query statusEither succeeded, failed, or finished when trigger_type is set to workflow
node_typesNoList of stringsNode on which to run the queryComma-separated list of control(control node) or data(data node)
output_parameterNoBooleanWhether to pass the last result row as query parameter(s) to the subsequent queryDefault: false

Success Response

{}

Error Responses

Required argument is missing

HTTP status code 400

{
  "error_code": "null-argument",
  "error_msg": "name should be not null"
}
name or description parameter length is invalid

HTTP status code 400

{
  "error_code": "invalid-argument",
  "error_msg": "'name' must be shorter than or equal to 255 characters."
}
trigger_type: invalid value

HTTP status code 400

{
  "error_code": "invalid-argument",
  "error_msg": "trigger_type value must be either 'cron' or 'workflow'."
}
cron_schedule is missing when trigger_type is cron

HTTP status code 400

{
  "error_code": "null-argument",
  "error_msg": "cron_schedule should be not null"
}
preceding_action is missing when trigger_type is workflow

HTTP status code 400

{
  "error_code": "null-argument",
  "error_msg": "preceding_action should be not null"
}
preceding_action: invalid value

HTTP status code 400

{
  "error_code": "invalid-argument",
  "error_msg": "preceding_action value must be one of 'finished', 'succeeded', 'failed'."
}
Scheduled query is not found

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "scheduled query not found: a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
Duplicated query name

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "duplicated scheduled query name: cpu-check"
}
Permission denied

HTTP status code 500

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