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.

HTTP Request

POST /api/sonar/scheduled-queries/disable

Request using cURL

curl -H "Authorization: Bearer <API_KEY>" \
     -d guids="GUID1,GUID2,GUIDN"
     -X POST https://HOSTNAME/api/sonar/scheduled-queries/disable

Request Parameter

KeyRequiredTypeDescriptionNote
guidsOStringGUID list of scheduled queriesComma-separated list

Success Responses

Successful Response
{
  "succeeded": 1,
  "failures": []
}
  • succeeded (32-bit integer): the total number of scheduled queries that have been successfully disabled, not including those already disabled.
  • failures (Array): Failure details
    • id (String): GUID of the scheduled query
    • reason (String): Error description
Partial Successful Response
Request Example
curl -k -H "Authorization: Bearer API_KEY" \
     -d guids="0ff16aa8-dbc1-458a-9769-342de5cf9219,65c6c0d3-b8a4-49b3-b4ea-ddd0e321c221,b7007eb2-c1df-4d4d-84f1-5d0af91db25d" \
     -X POST https://HOSTNAME/api/sonar/scheduled-queries/disable
Response Example
{
  "succeeded": 2,
  "failures": [
    {
      "id": "0ff16aa8-dbc1-458a-9769-342de5cf9219",
      "reason": "scheduled-query-not-found"
    }
  ]
}

Error Responses

Required argument 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."
}
Scheduled query is not found

HTTP status code 200

{
  "succeeded": 0,
  "failures": [
    {
      "id": "0fb16ff8-dbc1-458a-9769-342de5cf9219",
      "reason": "scheduled-query-not-found"
    }
  ]
}
No administrator privileges

HTTP status code 500

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