template.massremove

描述

object template.massremove(object parameters)

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

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

参数

(object) 包含要update的模板ID参数及应移除的objects.

参数 数据类型 描述
templateids
(required)
string/array 待更新模板的ID.
groupids string/array 从中移除指定模板的主机组.
macros string/array 从指定模板中delete的用户宏.
templateids_clear string/array 从指定模板(上游)解链并clear的模板.
templateids_link string/array 从指定模板(上游)解链的模板.

返回值

(object) 返回一个包含更新模板ID的object 该ID位于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
       }

从主机取消关联模板

将模板"10106"和"10104"从模板"10085"中解除关联。

请求:

{
           "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 文件中。