object task.create(object/array tasks)
This method allows to create a new task (such as collect diagnostic data or check items or low-level discovery rules without config reload).
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.
(object/array)
A task to create.
The method accepts tasks with the standard task properties.
Note that 'Execute now' tasks can be created only for the following types of items/discovery rules:
If item or discovery rule is of type "Dependent item", then top level master item must be of type:
(object)
Returns an object containing the IDs of the created tasks under the taskids
property. One task is created for each item and low-level discovery rule. The order of the returned IDs matches the order of the passed itemids
.
Create a task Execute now
for two items. One is an item, the other is a low-level discovery rule.
{
"jsonrpc": "2.0",
"method": "task.create",
"params": [
{
"type": 6,
"request": {
"itemid": "10092"
}
},
{
"type": 6,
"request": {
"itemid": "10093"
}
}
],
"id": 1
}
Response:
Create a task Refresh proxy configuration
for two proxies.
{
"jsonrpc": "2.0",
"method": "task.create",
"params": [
{
"type": 2,
"request": {
"proxy_hostids": ["10459", "10460"]
}
}
],
"id": 1
}
Response:
Create a task diagnostic information
.
{
"jsonrpc": "2.0",
"method": "task.create",
"params": [
{
"type": 1,
"request": {
"alerting": {
"stats": [
"alerts"
],
"top": {
"media.alerts": 10
}
},
"lld": {
"stats": "extend",
"top": {
"values": 5
}
}
},
"proxy_hostid": 0
}
],
"id": 1
}
Response:
CTask::create() in ui/include/classes/api/services/CTask.php.