dashboard.create

Description

object dashboard.create(object/array dashboards)

This method allows to create new 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) Dashboards to create.

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

ParameterTypeDescription
pagesarrayDashboard pages to be created for the dashboard. Dashboard pages will be ordered in the same order as specified.

Parameter behavior:
- required
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) on a single dashboard page.

Request:

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

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.