批量添加
描述
object templategroup.massadd(object parameters)
此方法允许您同时将多个相关对象添加到所有给定的模板组中。
此方法仅适用于 Admin 和 Super admin 用户类型。调用该方法的权限可在用户角色 设置中撤销。有关更多信息,请参见 User roles。
参数
(object) 包含要更新的模板组 ID 以及要添加到所有模板组中的对象的参数。
该方法接受以下参数。
| 参数 | 类型 | 说明 |
|---|---|---|
| groups | object/array | 要更新的模板组。 模板组必须仅定义 groupid 属性。参数行为: - 必需 |
| templates | object/array | 要添加到所有模板组中的模板。 模板必须仅定义 templateid 属性。参数行为: - 必需 |
返回值
(object) 返回一个对象,该对象包含groupids属性下已更新的模板组的ID.
示例
将模板添加到模板组中
将两个模板添加到ID为12和13的模板组中.
请求:
{
"jsonrpc": "2.0",
"method": "templategroup.massadd",
"params": {
"groups": [
{
"groupid": "12"
},
{
"groupid": "13"
}
],
"templates": [
{
"templateid": "10486"
},
{
"templateid": "10487"
}
]
},
"id": 1
}
响应:
{
"jsonrpc": "2.0",
"result": {
"groupids": [
"12",
"13"
]
},
"id": 1
}
参阅
来源
CTemplateGroup::massAdd() in ui/include/classes/api/services/CTemplateGroup.php.