This is the documentation page for an unsupported version of Zabbix.
Is this not what you were looking for? Switch to the current version or choose one from the drop-down menu.
Table of Contents

update()

Available since version: 1.8
The method is used to control all template attributes including template template linkage, macros and template group membership. The method is a wrapper for template.massUpdate function.

Parameters

Parameter Type Optional Description Details
templateid string Template name.
host any Yes New name for a template.
groups array Yes Update templates Host Group linkage. Missing objects will be linked, existed stay, others unlinked
hosts array Yes Update templates Hosts linkage. Missing objects will be linked, existed stay, others unlinked
macros array Yes Update templates Macros. Missing objects will be added, existed updated, others removed
templates array Yes Update templates Template linkage. Missing objects will be linked, existed stay, others unlinked
templates_clear array Yes Templates that should be unlinked and cleared.

Returns

Parameter Description
result Operation successful. Result will contain array of updated Template IDs.
error In case of any errors

Example

Change template name, link it to two hosts and unlink from others

{
       "jsonrpc":"2.0",
       "method":"template.update",
       "params":[{
           "templateid": "100100000014792",
           "host": "T1",
           "hosts": [{"hostid": "100100000010226" },{"hostid": "100100000010092"}]
       }],
       "auth":"700ca65537074ec963db7efabda78259",
       "id":2
       }

Retrieved updated template IDs:

{
       "jsonrpc":"2.0",
       "result": {
           "templateids":["100100000014792"]
       },
       "id":2
       }