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.
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 Parameter
| Key | Required | Type | Description | Note |
|---|---|---|---|---|
| guids | O | String | GUID list of scheduled queries | Comma-separated list |
| force | No | Boolean | Whether to force stop |
Success Response
Successful Request
{
"succeeded": 1,
"failures": []
}
- succeeded (32-bit integer): the total number of scheduled queries that have been successfully stopped, not including those already stopped.
- failures (Array): Failure details
- id (String): GUID of the scheduled query
- reason (String): Error description
Partial Successful Request
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/stop
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"
}