dashboard.get

Description

integer/array dashboard.get(object **parameters**)

The method allows to retrieve dashboards according to the given parameters.

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) Parameters defining the desired output.

The method supports the following parameters.

ParameterTypeDescription
dashboardidsstring/arrayReturn only dashboards with the given IDs.
selectWidgetsqueryReturn a widgets property with the dashboard widgets that are used in the dashboard.
selectUsersqueryReturn a users property with users that the dashboard is shared with.
selectUserGroupsqueryReturn a userGroups property with user groups that the dashboard is shared with.
sortfieldstring/arraySort the result by the given properties.

Possible value is: dashboardid.
countOutputbooleanThese parameters being common for all get methods are described in detail in the reference commentary page.
editableboolean
excludeSearchboolean
filterobject
limitinteger
outputquery
preservekeysboolean
searchobject
searchByAnyboolean
searchWildcardsEnabledboolean
sortorderstring/array
startSearchboolean

Return values

(integer/array) Returns either:

  • an array of objects;

  • the count of retrieved objects, if the countOutput parameter has been used.

Examples

Retrieving a dashboard by ID

Retrieve all data about dashboards “1” and “2”.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "dashboard.get",
  4. "params": {
  5. "output": "extend",
  6. "selectWidgets": "extend",
  7. "selectUsers": "extend",
  8. "selectUserGroups": "extend",
  9. "dashboardids": [
  10. "1",
  11. "2"
  12. ]
  13. },
  14. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  15. "id": 1
  16. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": [
  4. {
  5. "dashboardid": "1",
  6. "name": "Dashboard",
  7. "userid": "1",
  8. "private": "0",
  9. "users": [],
  10. "userGroups": [],
  11. "widgets": [
  12. {
  13. "widgetid": "9",
  14. "type": "systeminfo",
  15. "name": "",
  16. "x": "12",
  17. "y": "8",
  18. "width": "12",
  19. "height": "5",
  20. "view_mode": 0,
  21. "fields": []
  22. },
  23. {
  24. "widgetid": "8",
  25. "type": "problemsbysv",
  26. "name": "",
  27. "x": "12",
  28. "y": "4",
  29. "width": "12",
  30. "height": "4",
  31. "view_mode": 0,
  32. "fields": []
  33. },
  34. {
  35. "widgetid": "7",
  36. "type": "problemhosts",
  37. "name": "",
  38. "x": "12",
  39. "y": "0",
  40. "width": "12",
  41. "height": "4",
  42. "view_mode": 0,
  43. "fields": []
  44. },
  45. {
  46. "widgetid": "6",
  47. "type": "discovery",
  48. "name": "",
  49. "x": "6",
  50. "y": "9",
  51. "width": "6",
  52. "height": "4",
  53. "view_mode": 0,
  54. "fields": []
  55. },
  56. {
  57. "widgetid": "5",
  58. "type": "web",
  59. "name": "",
  60. "x": "0",
  61. "y": "9",
  62. "width": "6",
  63. "height": "4",
  64. "view_mode": 0,
  65. "fields": []
  66. },
  67. {
  68. "widgetid": "4",
  69. "type": "problems",
  70. "name": "",
  71. "x": "0",
  72. "y": "3",
  73. "width": "12",
  74. "height": "6",
  75. "view_mode": 0,
  76. "fields": []
  77. },
  78. {
  79. "widgetid": "3",
  80. "type": "favmaps",
  81. "name": "",
  82. "x": "8",
  83. "y": "0",
  84. "width": "4",
  85. "height": "3",
  86. "view_mode": 0,
  87. "fields": []
  88. },
  89. {
  90. "widgetid": "2",
  91. "type": "favscreens",
  92. "name": "",
  93. "x": "4",
  94. "y": "0",
  95. "width": "4",
  96. "height": "3",
  97. "view_mode": 0,
  98. "fields": []
  99. },
  100. {
  101. "widgetid": "1",
  102. "type": "favgraphs",
  103. "name": "",
  104. "x": "0",
  105. "y": "0",
  106. "width": "4",
  107. "height": "3",
  108. "view_mode": 0,
  109. "fields": []
  110. }
  111. ]
  112. },
  113. {
  114. "dashboardid": "2",
  115. "name": "My dashboard",
  116. "userid": "1",
  117. "private": "1",
  118. "users": [
  119. {
  120. "userid": "4",
  121. "permission": "3"
  122. }
  123. ],
  124. "userGroups": [
  125. {
  126. "usrgrpid": "7",
  127. "permission": "2"
  128. }
  129. ],
  130. "widgets": [
  131. {
  132. "widgetid": "10",
  133. "type": "problems",
  134. "name": "",
  135. "x": "0",
  136. "y": "0",
  137. "width": "12",
  138. "height": "5",
  139. "view_mode": 0,
  140. "fields": [
  141. {
  142. "type": "2",
  143. "name": "groupids",
  144. "value": "4"
  145. }
  146. ]
  147. }
  148. ]
  149. }
  150. ],
  151. "id": 1
  152. }

See also

Source

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