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参数 Type类型 Description说明
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请求:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "template.massremove",
  4. "params": {
  5. "templateids": [
  6. "10085",
  7. "10086"
  8. ],
  9. "groupids": "2"
  10. },
  11. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  12. "id": 1
  13. }

Response响应:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "templateids": [
  5. "10085",
  6. "10086"
  7. ]
  8. },
  9. "id": 1
  10. }

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

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

Request请求:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "template.massremove",
  4. "params": {
  5. "templateids": "10085",
  6. "hostids": [
  7. "10106",
  8. "10104"
  9. ]
  10. },
  11. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  12. "id": 1
  13. }

Response响应:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "templateids": [
  5. "10085"
  6. ]
  7. },
  8. "id": 1
  9. }

See also参考

Source来源

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