integer/array task.get(параметры объекта)
Метод позволяет получать задачи по заданным параметрам. Метод возвращает сведения только о задачах 'диагностической информации'.
Этот метод доступен только пользователю с типом доступа Супер-администратор. Разрешения на вызов метода можно отозвать в настройках ролей пользователя. Дополнительную информацию см. в разделе Роли пользователей.
(object) Parameters defining the desired output.
The method supports the following parameters.
| Parameter | Type | Description |
|---|---|---|
| taskids | string/array | Return only tasks with the given IDs. |
| output | query | These parameters being common for all get methods are described in detail in the reference commentary. |
| preservekeys | boolean |
(целое число/массив) Возвращает массив объектов.
Retrieve all data about task “1”.
Request:
{ "jsonrpc": "2.0", "method": "task.get", "params": { "output": "extend", "taskids": "1" }, "auth": "038e1d7b1735c6a5436ee9eae095879e", "id": 1 }Response:
{ "jsonrpc": "2.0", "result": [ { "taskid": "1", "type": "7", "status": "3", "clock": "1601039076", "ttl": "3600", "proxy_hostid": null, "request": { "alerting": { "stats": [ "alerts" ], "top": { "media.alerts": 10 } }, "lld": { "stats": "extend", "top": { "values": 5 } } }, "result": { "data": { "alerting": { "alerts": 0, "top": { "media.alerts": [] }, "time": 0.000663 }, "lld": { "rules": 0, "values": 0, "top": { "values": [] }, "time": 0.000442 } }, "status": "0" } } ], "id": 1 }CTask::get() в ui/include/classes/api/services/CTask.php.