Disable Scheduled Queries

Disables specified scheduled queries. Administrator privileges are required to call this API. This REST API supports partial failure. If any scheduled queries fail to be disabled, the failures parameter returns the identifiers of those scheduled queries and the failure reason.

Required Permissions

Requires the ADMIN role or higher.

HTTP Request

POST /api/sonar/scheduled-queries/disable
cURL Example
curl -H "Authorization: Bearer <API_KEY>" \
     -d guids="GUID1,GUID2,GUIDN"
     -X POST https://HOSTNAME/api/sonar/scheduled-queries/disable
Request Parameters
KeyRequiredTypeDescriptionNote
guidsYesStringGUID list of scheduled queriesComma-separated list

Success Response

All succeeded
{
  "succeeded": 1,
  "failures": []
}
  • succeeded (32-bit integer): Number of scheduled queries that were disabled. Scheduled queries that were already disabled are not counted and are not listed in failures.
  • failures (Array): Scheduled queries that failed to be disabled
    • id (String): GUID of the scheduled query
    • reason (String): Reason for the failure
Partially succeeded
Request example
curl -H "Authorization: Bearer <API_KEY>" \
     -d guids="a1b2c3d4-e5f6-7890-abcd-ef1234567890,b2c3d4e5-f6a7-8901-bcde-f12345678901" \
     -X POST https://HOSTNAME/api/sonar/scheduled-queries/disable
Response example
{
  "succeeded": 1,
  "failures": [
    {
      "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "reason": "scheduled-query-not-found"
    }
  ]
}

Error Responses

guids is missing

HTTP status code 400

{
  "error_code": "null-argument",
  "error_msg": "guids should be not null"
}
Identifier is not in valid GUID format

HTTP status code 400

{
  "error_code": "invalid-param-type",
  "error_msg": "guids should be guid type."
}
Permission denied

HTTP status code 500

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