[comment]: # aside: 5

[comment]: # ({66fb9690-66fb9690})
# dashboard.update

[comment]: # ({/66fb9690-66fb9690})

[comment]: # ({becba6de-f235159f})
### 説明

`object dashboard.update(object/array dashboards)`

このメソッドは、既存のダッシュボードを更新することができます。

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

[comment]: # ({/becba6de-f235159f})

[comment]: # ({bf54b1f0-62947aa0})
### パラメータ

`(object/array)` 更新するダッシュボードのプロパティ。

各ダッシュボードでは `dashboardid` プロパティを定義する必要があり、
その他のプロパティはすべて任意です。渡されたプロパティのみが
更新され、その他はすべて変更されません。

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

|パラメータ|[型](/manual/api/reference_commentary#data-types)|説明|
|--|--|------|
|pages|array|既存のダッシュボードページを置き換える[ダッシュボードページ](object#dashboard-page)。<br><br>ダッシュボードページは `dashboard_pageid` プロパティによって更新されます。`dashboard_pageid` プロパティを持たないオブジェクトについては新しいダッシュボードページが作成され、再利用されなかった既存のダッシュボードページは削除されます。ダッシュボードページは指定された順序と同じ順序で並べられます。ダッシュボードページのうち、指定されたプロパティのみが更新されます。|
|users|array|既存の要素を置き換える[ダッシュボードユーザー](object#dashboard-user)共有。|
|userGroups|array|既存の要素を置き換える[ダッシュボードユーザーグループ](object#dashboard-user-group)共有。|

[comment]: # ({/bf54b1f0-62947aa0})

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

`(object)` `dashboardids`プロパティの下にある更新されたダッシュボードのIDを含むオブジェクトを返します。

[comment]: # ({/28e89b38-28e89b38})

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

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

[comment]: # ({d0eb0276-7fcf7de4})
#### ダッシュボードの名前変更

ダッシュボードの名前を"SQL server status"に変更します。

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

```json
{
    "jsonrpc": "2.0",
    "method": "dashboard.update",
    "params": {
        "dashboardid": "2",
        "name": "SQL server status"
    },
    "id": 1
}
```

レスポンス:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "dashboardids": [
            "2"
        ]
    },
    "id": 1
}
```

[comment]: # ({/d0eb0276-7fcf7de4})

[comment]: # ({ed5d0499-b8348b8a})
#### ダッシュボードページの更新

最初のダッシュボードページの名前を変更し、2番目のダッシュボードページのウィジェットを置き換えて、3番目のページとして新しいページを追加します。他のすべてのダッシュボードページを削除します。

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

```json
{
    "jsonrpc": "2.0",
    "method": "dashboard.update",
    "params": {
        "dashboardid": "2",
        "pages": [
            {
                "dashboard_pageid": 1,
                "name": "Renamed Page"
            },
            {
                "dashboard_pageid": 2,
                "widgets": [
                    {
                        "type": "clock",
                        "x": 0,
                        "y": 0,
                        "width": 12,
                        "height": 3
                    }
                ]
            },
            {
                "display_period": 60
            }
        ]
    },
    "id": 1
}
```

レスポンス:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "dashboardids": [
            "2"
        ]
    },
    "id": 1
}
```

[comment]: # ({/ed5d0499-b8348b8a})

[comment]: # ({6990c258-e4a57dd3})
#### ダッシュボードの所有者の変更

Adminとsuper adminのみが使用できます。

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

```json
{
    "jsonrpc": "2.0",
    "method": "dashboard.update",
    "params": {
        "dashboardid": "2",
        "userid": "1"
    },
    "id": 1
}
```

レスポンス:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "dashboardids": [
            "2"
        ]
    },
    "id": 1
}
```

[comment]: # ({/6990c258-e4a57dd3})

[comment]: # ({9c4ba6ce-299ae089})
### 関連項目

-   [ダッシュボードページ](object#dashboard-page)
-   [ダッシュボードウィジェット](object#dashboard-widget)
-   [ダッシュボードウィジェットフィールド](object#dashboard-widget-field)
-   [ダッシュボードユーザー](object#dashboard-user)
-   [ダッシュボードユーザーグループ](object#dashboard-user-group)

[comment]: # ({/9c4ba6ce-299ae089})

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

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

[comment]: # ({/456ac32b-456ac32b})
