[comment]: # ({8c711e69-8c711e69})
# maintenance.update

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

[comment]: # ({e3d076ea-292dcffa})
### 説明

`object maintenance.update(object/array maintenances)`

このメソッドは、既存のメンテナンスを更新するためのものです。

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

[comment]: # ({/e3d076ea-292dcffa})

[comment]: # ({364d131c-678c22b3})
### パラメータ

`(object/array)` 更新するメンテナンスのプロパティ。

各メンテナンスでは `maintenanceid` プロパティを定義する必要があり、
その他のプロパティはすべて任意です。渡されたプロパティのみが
更新され、その他はすべて変更されません。

このメソッドは、[標準のメンテナンス
プロパティ](object#maintenance)に加えて、以下の
パラメータを受け付けます。

|パラメータ|[型](/manual/api/reference_commentary#data-types)|説明|
|--|--|------|
|groups|object/array|現在のグループを置き換える[ホストグループ](/manual/api/reference/hostgroup/object)。<br><br>ホストグループでは `groupid` プロパティのみを定義する必要があります。<br><br>[パラメータの動作](/manual/api/reference_commentary#parameter-behavior):<br>- `hosts` が設定されていない場合は *必須*|
|hosts|object/array|現在のホストを置き換える[ホスト](/manual/api/reference/host/object)。<br><br>ホストでは `hostid` プロパティのみを定義する必要があります。<br><br>[パラメータの動作](/manual/api/reference_commentary#parameter-behavior):<br>- `groups` が設定されていない場合は *必須*|
|timeperiods|object/array|現在の期間を置き換えるメンテナンスの[期間](/manual/api/reference/maintenance/object#time-period)。|
|tags|object/array|現在のタグを置き換える[障害タグ](/manual/api/reference/maintenance/object#problem-tag)。<br><br>[パラメータの動作](/manual/api/reference_commentary#parameter-behavior):<br>- [メンテナンスオブジェクト](object#maintenance) の `maintenance_type` が "with data collection" に設定されている場合に *サポート*|

[comment]: # ({/364d131c-678c22b3})

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

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

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

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

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

[comment]: # ({ffac6646-25215f8d})
#### 異なるホストの割り当て

現在メンテナンスに割り当てられているホストを2つの異なるホストに置き換えます。

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

```json
{
    "jsonrpc": "2.0",
    "method": "maintenance.update",
    "params": {
        "maintenanceid": "3",
        "hosts": [
            {"hostid": "10085"},
            {"hostid": "10084"}
        ]
    },
    "id": 1
}
```

レスポンス:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "maintenanceids": [
            "3"
        ]
    },
    "id": 1
}
```

[comment]: # ({/ffac6646-25215f8d})

[comment]: # ({db5fcf06-82b3ef0e})
### 関連項目

-   [期間](object#time-period)

[comment]: # ({/db5fcf06-82b3ef0e})

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

CMaintenance::update() in *ui/include/classes/api/services/CMaintenance.php*.

[comment]: # ({/63ad1661-63ad1661})
