This is a translation of the original English documentation page. Help us make it better.

dashboard.update

説明

object dashboard.update(object/array dashboards)

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

このメソッドは、どのタイプのユーザーでも利用可能です。このメソッドを呼び出す許可は、ユーザーロール設定で
取り消すことができます。詳しくは User roles をご覧ください。

パラメータ

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

dashboardid プロパティは各ダッシュボードに対して指定する必要があり、その他のプロパティは任意です。
指定されたプロパティのみが更新されます。

standard dashboard properties に加えて、このメソッドは以下のパラメータを受け付けます。

パラメータ Type 説明
pages array Dashboard pages to replace the existing dashboard pages.

Dashboard pages are updated by the dashboard_pageid property. New dashboard pages will be created for objects without dashboard_pageid property and the existing dashboard pages will be deleted if not reused. Dashboard pages will be ordered in the same order as specified. Only the specified properties of the dashboard pages will be updated. At least one dashboard page object is required for pages property.
users array Dashboard user shares to replace the existing elements.
userGroups array Dashboard user group shares to replace the existing elements.

戻り値

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

ダッシュボードの名前変更

ダッシュボードの名前を "SQLサーバーの状態" に変更します。

Request:

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

Response:

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

ダッシュボードページの更新

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

Request:

{
           "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": 4,
                               "height": 3
                           }
                       ]
                   },
                   {
                       "display_period": 60
                   }
               ]
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

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

ダッシュボードの所有者を変更する

admins と super admins のみ利用可能です

Request:

{
           "jsonrpc": "2.0",
           "method": "dashboard.update",
           "params": {
               "dashboardid": "2",
               "userid": "1"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 2
       }

Response:

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

参照

ソース

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