[comment]: # translation:outdated

[comment]: # ({e42e8a0a-e42e8a0a})
# template.massupdate

[comment]: # ({/e42e8a0a-e42e8a0a})

[comment]: # ({34ba852b-cf27d8f8})
### 説明

`object template.massupdate(object parameters)`

このメソッドで、関連するオブジェクトを同時に置換または削除して複数のテンプレートのプロパティを更新できます。

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

[comment]: # ({/34ba852b-cf27d8f8})

[comment]: # ({3d8eea6c-1f7d5759})
### パラメータ

`(object)` 更新するテンプレートの ID とテンプレートを置き換えるオブジェクトを含むパラメーター

このメソッドは、次のパラメーターを受け入れます

|パラメータ|[タイプ](/manual/api/reference_commentary#data_types)|説明|
|--|--|------|
|**templates**<br>(必須)|object/array|更新するテンプレート。<br><br>テンプレートには `templateid` プロパティが定義されている必要があります。|
|groups|object/array|テンプレートが属する現在のホストグループを置換するホストグループ。<br><br>ホストグループには`groupid`プロパティが定義されている必要があります。|
|macros|object/array|指定されたテンプレートの現在のユーザー マクロを置換するユーザー マクロ。|
|templates\_clear|object/array|指定されたテンプレートからリンクを解除してクリアするテンプレート。<br><br>テンプレートには `templateid` プロパティが定義されている必要があります。|
|templates\_link|object/array|現在リンクされているテンプレートを置き換えるテンプレート。<br><br>テンプレートには `templateid` プロパティが定義されている必要があります。|

[comment]: # ({/3d8eea6c-1f7d5759})

[comment]: # ({dcba01c8-dcba01c8})
### 戻り値

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

[comment]: # ({/dcba01c8-dcba01c8})

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

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

[comment]: # ({new-d18b091c})
#### Unlinking a template

Unlink and clear template "10091" from the given templates.

[Request](/manual/api#performing-requests):

```json
{
    "jsonrpc": "2.0",
    "method": "template.massupdate",
    "params": {
        "templates": [
            {
                "templateid": "10085"
            },
            {
                "templateid": "10086"
            }
        ],
        "templates_clear": [
            {
                "templateid": "10091"
            }
        ]
    },
    "id": 1
}
```

Response:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "templateids": [
            "10085",
            "10086"
        ]
    },
    "id": 1
}
```

[comment]: # ({/new-d18b091c})

[comment]: # ({0528db5a-0ecefb75})
#### ホスト グループの置換

指定されたテンプレートからテンプレート"10091"のリンクを解除してクリアします。

Request:

```json
{
    "jsonrpc": "2.0",
    "method": "template.massupdate",
    "params": {
        "templates": [
            {
                "templateid": "10085"
            },
            {
                "templateid": "10086"
            }
        ],
        "templates_clear": [
            {
                "templateid": "10091"
            }
        ]
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Response:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "templateids": [
            "10085",
            "10086"
        ]
    },
    "id": 1
}
```

[comment]: # ({/0528db5a-0ecefb75})

[comment]: # ({2c69f062-5d283e35})
### 参照

-   [template.update](update)
-   [template.massadd](massadd)
-   [Host group](/manual/api/reference/hostgroup/object#host_group)
-   [User macro](/manual/api/reference/usermacro/object#hosttemplate_level_macro)

[comment]: # ({/2c69f062-5d283e35})

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

CTemplate::massUpdate() in
*ui/include/classes/api/services/CTemplate.php*.

[comment]: # ({/b5f8dcd9-b5f8dcd9})
