object template.massadd(object parameters)
此方法允许将多个相关的 objects 同时添加到给定的模板中。
此方法仅对 Admin(管理员) 和 Super admin(超级管理员) 用户类型可用。调用该方法的权限可以在用户角色设置中撤销。更多信息请参见 User roles。
(object)
参数包含要 update 的模板的 ID 以及要添加到模板的 objects。
该方法接受以下参数。
参数 | 数据类型 | 描述 |
---|---|---|
templates | object/array | 要更新的 Templates。 模板必须仅定义了 templateid 属性。参数行为: - 必填 |
groups | object/array | 要将给定模板添加到的 Template groups。 模板组必须仅定义了 groupid 属性。 |
macros | object/array | 要为给定模板创建的 User macros。 |
templates_link | object/array | 要链接到给定模板的 Templates。 模板必须仅定义了 templateid 属性。 |
(object)
返回一个 object,其中包含更新后的模板在 templateids
属性下的 ID。
将模板组 "2" 添加到两个模板中。
执行请求:
{
"jsonrpc": "2.0",
"method": "template.massadd",
"params": {
"templates": [
{
"templateid": "10085"
},
{
"templateid": "10086"
}
],
"groups": [
{
"groupid": "2"
}
]
},
"id": 1
}
响应:
将模板“10106”和“10104”链接到模板“10073”。
执行请求:
{
"jsonrpc": "2.0",
"method": "template.massadd",
"params": {
"templates": [
{
"templateid": "10073"
}
],
"templates_link": [
{
"templateid": "10106"
},
{
"templateid": "10104"
}
]
},
"id": 1
}
响应:
CTemplate::massAdd() 在 ui/include/classes/api/services/CTemplate.php 中。