检索模板仪表盘

描述

integer/array templatedashboard.get(object parameters)

该方法允许根据给定的参数检索模板仪表盘。

此方法对于任何用户可用。可以在用户角色设置中撤销调用该方法的权限。 详情查阅 User roles

参数

(object) 定义所需输出的参数。

该方法支持以下参数。

参数类型描述
dashboardidsstring/array仅返回具有给定ID的模板仪表盘。
templateidsstring/arary仅返回属于给定模板的模板仪表盘。
selectPagesquery按正确顺序返回带有模板仪表盘页面的pages属性。
sortfieldstring/array按给定属性对结果进行排序。

可能的值是: dashboardid and name.
countOutputboolean这些参数对于所有get方法都是通用的,在参考注释中有详细描述。
editableboolean
excludeSearchboolean
filterobject
limitinteger
outputquery
preservekeysboolean
searchobject
searchByAnyboolean
searchWildcardsEnabledboolean
sortorderstring/array
startSearchboolean

返回值

(integer/array) 返回两者其一:

  • 一个对象数组;
  • 如果使用了’countOutput’参数,则对检索对象进行计数。

示例

检索模板仪表盘

检索指定模板的所有带有组件的模板仪表盘。

请求:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "templatedashboard.get",
  4. "params": {
  5. "output": "extend",
  6. "selectPages": "extend",
  7. "templateids": "10001"
  8. },
  9. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  10. "id": 1
  11. }

响应:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": [
  4. {
  5. "dashboardid": "23",
  6. "name": "Docker overview",
  7. "templateid": "10001",
  8. "display_period": "30",
  9. "auto_start": "1",
  10. "uuid": "6dfcbe0bc5ad400ea9c1c2dd7649282f",
  11. "pages": [
  12. {
  13. "dashboard_pageid": "1",
  14. "name": "",
  15. "display_period": "0",
  16. "widgets": [
  17. {
  18. "widgetid": "220",
  19. "type": "graph",
  20. "name": "",
  21. "x": "0",
  22. "y": "0",
  23. "width": "12",
  24. "height": "5",
  25. "view_mode": "0",
  26. "fields": [
  27. {
  28. "type": "6",
  29. "name": "graphid",
  30. "value": "1125"
  31. }
  32. ]
  33. },
  34. {
  35. "widgetid": "221",
  36. "type": "graph",
  37. "name": "",
  38. "x": "12",
  39. "y": "0",
  40. "width": "12",
  41. "height": "5",
  42. "view_mode": "0",
  43. "fields": [
  44. {
  45. "type": "6",
  46. "name": "graphid",
  47. "value": "1129"
  48. }
  49. ]
  50. },
  51. {
  52. "widgetid": "222",
  53. "type": "graph",
  54. "name": "",
  55. "x": "0",
  56. "y": "5",
  57. "width": "12",
  58. "height": "5",
  59. "view_mode": "0",
  60. "fields": [
  61. {
  62. "type": "6",
  63. "name": "graphid",
  64. "value": "1128"
  65. }
  66. ]
  67. },
  68. {
  69. "widgetid": "223",
  70. "type": "graph",
  71. "name": "",
  72. "x": "12",
  73. "y": "5",
  74. "width": "12",
  75. "height": "5",
  76. "view_mode": "0",
  77. "fields": [
  78. {
  79. "type": "6",
  80. "name": "graphid",
  81. "value": "1126"
  82. }
  83. ]
  84. },
  85. {
  86. "widgetid": "224",
  87. "type": "graph",
  88. "name": "",
  89. "x": "0",
  90. "y": "10",
  91. "width": "12",
  92. "height": "5",
  93. "view_mode": "0",
  94. "fields": [
  95. {
  96. "type": "6",
  97. "name": "graphid",
  98. "value": "1127"
  99. }
  100. ]
  101. }
  102. ]
  103. }
  104. ]
  105. }
  106. ],
  107. "id": 1
  108. }

参阅

源码

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