2022 Zabbix中国峰会
2022 Zabbix中国峰会

template.massremove

Description说明

object template.massremove(object parameters)

This method allows to remove related objects from multiple templates该方法允许从多个模板中删除相关对象.

Parameters参数

(object) Parameters containing the IDs of the templates to update and the objects that should be removed包含要更新的模板的ID和应删除的对象的参数.

Parameter参数 T pe类型 Des ription说明
templateids
(required)
string/array IDs of the templates to be updated要更新的模板的ID.
groupids string/array Host groups to remove the given templates from从给定的模板中删除主机组.
hostids string/array Hosts or templates to unlink the given templates from取消链接给定模板的主机或模板.
macros string/array User macros to delete from the given templates删除指定模板的用户宏.
templateids_clear string/array Templates to unlink and clear from the given templates从给定的模板中取消链接和清除的模板.
templateids_link string/array Templates to unlink from the given templates取消与给定模板链接的模板.

Return values返回值

(object) Returns an object containing the IDs of the updated templates under the templateids property. (object)返回一个对象,它包含templateids属性下更新的模板的ID.

Examples范例

Removing templates from a group从组中删除模板

Remove two templates from group "2"从组"2"中删除两个模板.

Request请求:

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

Response响应:

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

Unlinking templates from a host从主机取消链接模板

Unlink template "10085" from two hosts从两个主机取消链接模板"10085".

Request请求:

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

Response响应:

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

See also参考

Source来源

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