template.massremove

描述

object template.massremove(object parameters)

此方法允许从多个模板中移除关联的objects。

此方法仅适用于管理员超级管理员用户类型。调用该方法的权限可在用户角色设置中撤销。更多信息请参阅User roles

参数

(object) 参数包含待更新模板的ID以及需要移除的objects。

参数 数据类型 描述
templateids
(required)
string/array 待更新模板的ID。
groupids string/array 需要从中移除指定模板的主机组。
macros string/array 需要从指定模板中删除的用户宏。
templateids_clear string/array 需要解除关联并从指定模板中清除的模板(上游)。
templateids_link string/array 需要从指定模板中解除关联的模板(上游)。

返回值

(object) 返回一个包含更新模板ID的object,存储在templateids属性下。

示例

从组中移除模板

从"2"组中移除两个模板。

请求:

{
           "jsonrpc": "2.0",
           "method": "template.massremove",
           "params": {
               "templateids": [
                   "10085",
                   "10086"
               ],
               "groupids": "2"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

响应:

{
           "jsonrpc": "2.0",
           "result": {
               "templateids": [
                   "10085",
                   "10086"
               ]
           },
           "id": 1
       }

从主机取消关联模板

从模板"10085"取消关联模板"10106"和"10104"。

请求:

{
           "jsonrpc": "2.0",
           "method": "template.massremove",
           "params": {
               "templateids": "10085",
               "templateids_link": [
                   "10106",
                   "10104"
               ]
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

响应:

{
           "jsonrpc": "2.0",
           "result": {
               "templateids": [
                   "10085"
               ]
           },
           "id": 1
       }

监控项

来源

CTemplate::massRemove() 方法位于 ui/include/classes/api/services/CTemplate.php 文件中。