Stop Scheduled Queries

Stops 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/stop
cURL Example
curl -H "Authorization: Bearer <API_KEY>" \
     -d guids="GUID1,GUID2,GUIDN"
     -X POST https://HOSTNAME/api/sonar/scheduled-queries/stop
Request Parameters
KeyRequiredTypeDescriptionNote
guidsYesStringGUID list of scheduled queriesComma-separated list
forceNoBooleanWhether to force stop

Success Response

All succeeded
{
  "succeeded": 1,
  "failures": []
}
  • succeeded (32-bit integer): Number of scheduled queries that were stopped. Scheduled queries that were not running are not counted and are not listed in failures.
  • failures (Array): Scheduled queries that failed to be stopped
    • 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/stop
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"
}