[comment]: # ({8e295f21-f9e8f670})
# templategroup.massadd

[comment]: # ({/8e295f21-f9e8f670})

[comment]: # ({4eebb3e3-b5ff62ed})
### 説明

`object templategroup.massadd(object parameters)`

このメソッドは、指定されたテンプレートグループすべてに複数の関連オブジェクトを同時に追加することができます。

::: noteclassic
このメソッドは、*Admin*および*Super admin*タイプのユーザーのみ利用可能です。メソッドを呼び出す権限は、ユーザーの役割の設定で取り消すことができます。詳細は[ユーザーの役割](/manual/web_interface/frontend_sections/users/user_roles)を参照してください。
:::

[comment]: # ({/4eebb3e3-b5ff62ed})

[comment]: # ({8293b941-3ff1a765})
### パラメータ

`(object)` 更新するテンプレートグループのIDと、すべてのテンプレートグループに追加するオブジェクトを含むパラメータ

このメソッドは以下のパラメータを受け入れます。

|パラメータ|[タイプ](/manual/api/reference_commentary#data_types)|説明|
|--|--|------|
|groups|object/array|更新する[テンプレートグループ](/manual/api/reference/templategroup/object#template_group)<br><br>テンプレートグループには、`groupid` プロパティのみを定義する必要があります。<br><br>[パラメータの動作](/manual/api/reference_commentary#parameter-behavior):<br>- *必須*|
|templates|object/array|すべてのテンプレート グループに追加する[テンプレート](/manual/api/reference/template/object#template)<br><br>テンプレートには `templateid` プロパティのみが定義されている必要があります。<br><br>[パラメーターの動作](/manual/api/reference_commentary#parameter-behavior):<br>- *必須*|

[comment]: # ({/8293b941-3ff1a765})

[comment]: # ({9cf84bdf-cc7938a3})
### 戻り値

`(object)` `groupids`プロパティの下に更新されたテンプレートグループのIDを含むオブジェクトを返します。

[comment]: # ({/9cf84bdf-cc7938a3})

[comment]: # ({b41637d2-518dc5ee})
### 例

[comment]: # ({/b41637d2-518dc5ee})

[comment]: # ({d6d75ca0-3954c00e})
#### テンプレートグループへテンプレートの追加

ID12と13のテンプレートグループへ二つのテンプレートを追加します。

[リクエスト](/manual/api#performing-requests) :

```json
{
    "jsonrpc": "2.0",
    "method": "templategroup.massadd",
    "params": {
        "groups": [
            {
                "groupid": "12"
            },
            {
                "groupid": "13"
            }
        ],
        "templates": [
            {
                "templateid": "10486"
            },
            {
                "templateid": "10487"
            }
        ]
    },
    "id": 1
}
```

レスポンス :

```json
{
    "jsonrpc": "2.0",
    "result": {
        "groupids": [
            "12",
            "13"
        ]
    },
    "id": 1
}
```

[comment]: # ({/d6d75ca0-3954c00e})

[comment]: # ({f3cd9368-d05fe284})
### 参照

-   [Template](/manual/api/reference/template/object#template)

[comment]: # ({/f3cd9368-d05fe284})

[comment]: # ({afff73ad-47263542})
### ソース

CTemplateGroup::massAdd() in
*ui/include/classes/api/services/CTemplateGroup.php*.

[comment]: # ({/afff73ad-47263542})
