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


Available since version: 1.8


Multidimensional array with usermacros data

Parameter Type Optional Description Details
macros array Usermacros to add.
hosts array Yes Host objects that should get added usermacros.
templates array Yes Template objects that should get added usermacros.

NOTE: one of the hosts or templates is required.


Parameter Description
result Operation successful. Result will contain array of added host/template usermacro IDs.
error In case of any errors


Add two usermacros on two hosts with IDs "10092", "10086" and on two templates with IDs "10052", "10053":

           "macros": [
               {"macro": "{$MACRO1}", "value": "MACRO1"},
               {"macro": "{$MACRO2}", "value": "MACRO2"}
           "hosts": [ 
               {"hostid": "10092"},
               {"hostid": "10086"}
           "templates": [
               {"templateid": "10052"},
               {"templateid": "10053"}

Host and template usermacros added successfully:


NOTE: host and/or template usermacros will be listed together in the "hostmacroids" array.

Error when some host or template does not exist:

           "message":"Application error.",
           "data":"[ CUserMacro::massUpdate ] You do not have permission to perform this operation"