dashboard.update

Description

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

This method allows to update existing dashboards.

This method is available to users of any type. Permissions to call the method can be revoked in user role settings. See User roles for more information.

Parameters

(object/array) Dashboard properties to be updated.

The dashboardid property must be defined for each dashboard, all other properties are optional. Only the passed properties will be updated, all others will remain unchanged.

Additionally to the standard dashboard properties, the method accepts the following parameters.

ParameterTypeDescription
widgetsarrayDashboard widgets to replace existing dashboard widgets.

Dashboard widgets are updated by widgetid property. Widgets without widgetid property will be created.
usersarrayDashboard user shares to replace the existing elements.
userGroupsarrayDashboard user group shares to replace the existing elements.

Return values

(object) Returns an object containing the IDs of the updated dashboards under the dashboardids property.

Examples

Renaming a dashboard

Rename a dashboard to “SQL server status”.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "dashboard.update",
  4. "params": {
  5. "dashboardid": "2",
  6. "name": "SQL server status"
  7. },
  8. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  9. "id": 1
  10. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "dashboardids": [
  5. "2"
  6. ]
  7. },
  8. "id": 1
  9. }

Change dashboard owner

Available only for admins and super admins.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "dashboard.update",
  4. "params": {
  5. "dashboardid": "2",
  6. "userid": "1"
  7. },
  8. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  9. "id": 2
  10. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "dashboardids": [
  5. "2"
  6. ]
  7. },
  8. "id": 2
  9. }

See also

Source

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