You are viewing documentation for the development version, it may be incomplete.
Join our translation project and help translate Zabbix documentation into your native language.

task.get

Description

integer/array task.get(object parameters)

The method allows to retrieve tasks according to the given parameters. Method returns details only about 'diagnostic information' tasks.

This method is only available to Super admin user type. Permissions to call the method can be revoked in user role settings. See User roles for more information.

Parameters

(object) Parameters defining the desired output.

The method supports the following parameters.

Parameter Type Description
taskids ID/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

Return values

(integer/array) Returns an array of objects.

Examples

Retrieve task by ID

Retrieve all the data about the task with the ID "1".

Request:

{
           "jsonrpc": "2.0",
           "method": "task.get",
           "params": {
               "output": "extend",
               "taskids": "1"
           },
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "taskid": "1",
                   "type": "7",
                   "status": "3",
                   "clock": "1601039076",
                   "ttl": "3600",
                   "proxyid": 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
       }

See also

Source

CTask::get() in ui/include/classes/api/services/CTask.php.