template.massremove

描述

object template.massremove(object parameters)

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

此方法仅对 AdminSuper admin 用户类型可用。 可以在用户角色设置中撤销调用该方法的权限。更多信息请参见 User roles

参数

(object) 包含要更新的模板 ID 以及应移除的对象的参数。

参数 类型 说明
templateids ID/array 要更新的模板的 ID。

参数行为
- 必需
groupids ID/array 要从中移除指定模板的模板组的 ID。
macros string/array 要从指定模板中删除的用户宏的 ID。
templateids_clear ID/array 要与指定模板解除关联并清除的模板的 ID(上游)。
templateids_link ID/array 要与指定模板解除关联的模板的 ID(上游)。

返回值

(object) 返回一个 object,其中包含更新后的模板ID, 位于 templateids 属性下。

示例

从组中移除模板

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

执行请求:

{
    "jsonrpc": "2.0",
    "method": "template.massremove",
    "params": {
        "templateids": [
            "10085",
            "10086"
        ],
        "groupids": "2"
    },
    "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"
        ]
    },
    "id": 1
}

响应:

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

另请参阅

来源

CTemplate::massRemove() 在 ui/include/classes/api/services/CTemplate.php 中。