This method allows to update existing items.
Web items cannot be updated via the Zabbix API.
This method is only available to Admin and Super admin user types. Permissions to call the method can be revoked in user role settings. See for more information.
(object/array)
Item properties to be updated.
The itemid
property must be defined for each item, all other properties are optional. Only the passed properties will be updated, all others will remain unchanged.
Additionally to the standard item properties, the method accepts the following parameters.
(object)
Returns an object containing the IDs of the updated items under the itemids
property.
Enabling an item
Request:
Response:
{
"jsonrpc": "2.0",
"result": {
"itemids": [
"10092"
]
},
"id": 1
}
Update dependent item
Update Dependent item name and Master item ID. Only dependencies on same host are allowed, therefore Master and Dependent item should have same hostid.
Request:
{
"jsonrpc": "2.0",
"method": "item.update",
"name": "Dependent item updated name",
"master_itemid": "25562",
"itemid": "189019"
"auth": "700ca65537074ec963db7efabda78259",
"id": 1
}
Response:
Update HTTP agent item
Enable item value trapping.
Request:
{
"jsonrpc": "2.0",
"method": "item.update",
"params": {
"itemid": "23856",
"allow_traps": "1"
},
"auth": "700ca65537074ec963db7efabda78259",
"id": 1
}
{
"jsonrpc": "2.0",
"result": {
"itemids": [
"23856"
},
}
Updating an item with preprocessing
Update an item with item preprocessing rule “In range”.
Request:
Response:
{
"jsonrpc": "2.0",
"result": {
"itemids": [
"23856"
]
},
"id": 1
}
Updating a script item
Update a script item with a different script and remove unnecessary parameters that were used by previous script.
Request:
{
"jsonrpc": "2.0",
"method": "item.update",
"params": {
"itemid": "23865",
"parameters": [],
"script": "Zabbix.Log(3, 'Log test');\nreturn 1;"
},
"auth": "700ca65537074ec963db7efabda78259",
"id": 1
Response:
CItem::update() in ui/include/classes/api/services/CItem.php.