object usermacro.update(object/array hostMacros)
此方法用于更新现有的主机宏.
此方法只有Admin(管理员) 和 Super admin(超级管理员) 用户可用.可以在用户角色设置中撤销调用该方法的权限.更多信息请查看 User roles.
(object/array)
需要更新的Host macro properties .
每个主机宏必须定义 hostmacroid
参数, 其他参数均为可选的. 只有通过的属性才会被更新,其他属性保持不变.
(object)
返回包含 hostmacroids
属性(其中包含被更新主机宏的ID)的对象.
更改一个主机宏"public"的值.
请求:
{
"jsonrpc": "2.0",
"method": "usermacro.update",
"params": {
"hostmacroid": "1",
"value": "public"
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
返回:
Convert discovery rule created "automatic" macro to "manual" and change its value to "new-value".
Request:
{
"jsonrpc": "2.0",
"method": "usermacro.update",
"params": {
"hostmacroid": "1",
"value": "new-value",
"automatic": "0"
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
Response:
CUserMacro::update() in ui/include/classes/api/services/CUserMacro.php.