这是原厂英文文档的翻译页面. 欢迎帮助我们 完善文档.
2022 Zabbix中国峰会
2022 Zabbix中国峰会

批量删除模板

描述

object template.massremove(object parameters)

此方法允许从多个模板中删除相关对象。

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

参数

(object) 包含要更新的模板ID和应删除的对象的参数。

参数 类型 描述
templateids
(必须)
string/array 要更新的模板的ID。
groupids string/array 从主机组中删除给定模板。
macros string/array 从给定模板中删除的用户宏。
templateids_clear string/array 从指定模板(上游)中取消模板链接并清除数据。
templateids_link string/array 从指定模板(上游)中取消模板链接。

返回值

(object) 返回一个对象,该对象包含templateids属性下已更新模板的ID。

示例

从一个群组中删除模版

从群组“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
       }

Unlinking templates from a host

Unlink templates "10106" and "10104" from template "10085".

Request:

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

Response:

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

参阅

源码

CTemplate::massRemove() in ui/include/classes/api/services/CTemplate.php.