This method allows to simultaneously add multiple related objects to the given templates. 此方法允许同时替换或删除相关对象并更新多个模板上的属性。

    Parameters 参数

    (object) Parameters containing the IDs of the templates to update and the objects to add to the templates. (object)参数包含需要更新的模板ID以及添加到模板的对象。 The method accepts the following parameters. 该方法接受以下参数。

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

    Examples 范例

    Adding templates to a group 添加模板到组

    Add two templates to the host group “2”. 添加两个模板到ID为“2”的主机组中。

    Response 响应:

    Linking a template to hosts 链接模板到主机

    Link template “10073” to two hosts. 链接ID为“10073”的模板到两台主机。

    Request 请求:

    Response 响应:

    Source 源码

    CTemplate::massAdd() in frontends/php/include/classes/api/services/CTemplate.php. CTemplate::massAdd()方法可在frontends/php/include/classes/api/services/CTemplate.php中参考。