dashboard.create

Description

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

This method allows to create new dashboards.

Parameters

(object/array) Dashboards to create.

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

ParameterTypeDescription
widgetsarrayDashboard widgets to be created for the dashboard.
usersarrayDashboard user shares to be created on the dashboard.
userGroupsarrayDashboard user group shares to be created on the dashboard.

Return values

(object) Returns an object containing the IDs of the created dashboards under the dashboardids property. The order of the returned IDs matches the order of the passed dashboards.

Examples

Creating a dashboard

Create a dashboard named “My dashboard” with one Problems widget with tags and using two types of sharing (user group and user).

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "dashboard.create",
  4. "params": {
  5. "name": "My dashboard",
  6. "widgets": [
  7. {
  8. "type": "problems",
  9. "x": 0,
  10. "y": 0,
  11. "width": 12,
  12. "height": 5,
  13. "view_mode": 0,
  14. "fields": [
  15. {
  16. "type": 1,
  17. "name": "tags.tag.0",
  18. "value": "service"
  19. },
  20. {
  21. "type": 0,
  22. "name": "tags.operator.0",
  23. "value": 1
  24. },
  25. {
  26. "type": 1,
  27. "name": "tags.value.0",
  28. "value": "zabbix_server"
  29. }
  30. ]
  31. }
  32. ],
  33. "userGroups": [
  34. {
  35. "usrgrpid": "7",
  36. "permission": "2"
  37. }
  38. ],
  39. "users": [
  40. {
  41. "userid": "4",
  42. "permission": "3"
  43. }
  44. ]
  45. },
  46. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  47. "id": 1
  48. }

Response:

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

See also

Source

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