templatedashboard.get

描述

integer/array templatedashboard.get(object parameters)

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

此方法适用于任何类型的用户。可以在用户角色设置中撤销调用该方法的权限。更多信息请参见 User roles

参数

(object) 定义期望输出的参数。

该方法支持以下参数。

参数 数据类型 说明
dashboardids ID/array 仅返回具有指定ID的模板仪表板。
templateids ID/array 仅返回属于指定模板的模板仪表板。
selectPages query 返回包含模板仪表板页面的pages属性,并按正确顺序排列。
sortfield string/array 按照指定属性对结果进行排序。

可能的值:dashboardidname
countOutput boolean 这些参数在通用get方法参数中进行了描述。
editable boolean
excludeSearch boolean
filter object
limit integer
output query
preservekeys boolean
search object
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch boolean

返回值

(integer/array) 返回以下之一:

  • objects 的 array;
  • 如果使用了 countOutput 参数,则为检索到的 objects 的数量。

示例

检索模板仪表板

检索指定模板的所有包含小部件的模板仪表板。

执行请求:

{
           "jsonrpc": "2.0",
           "method": "templatedashboard.get",
           "params": {
               "output": "extend",
               "selectPages": "extend",
               "templateids": "10001"
           },
           "id": 1
       }

响应:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "dashboardid": "23",
                   "name": "Docker overview",
                   "templateid": "10001",
                   "display_period": "30",
                   "auto_start": "1",
                   "uuid": "6dfcbe0bc5ad400ea9c1c2dd7649282f",
                   "pages": [
                       {
                           "dashboard_pageid": "1",
                           "name": "",
                           "display_period": "0",
                           "widgets": [
                               {
                                   "widgetid": "220",
                                   "type": "graph",
                                   "name": "",
                                   "x": "0",
                                   "y": "0",
                                   "width": "36",
                                   "height": "5",
                                   "view_mode": "0",
                                   "fields": [
                                       {
                                           "type": "6",
                                           "name": "graphid",
                                           "value": "1125"
                                       }
                                   ]
                               },
                               {
                                   "widgetid": "221",
                                   "type": "graph",
                                   "name": "",
                                   "x": "12",
                                   "y": "0",
                                   "width": "36",
                                   "height": "5",
                                   "view_mode": "0",
                                   "fields": [
                                       {
                                           "type": "6",
                                           "name": "graphid",
                                           "value": "1129"
                                       }
                                   ]
                               },
                               {
                                   "widgetid": "222",
                                   "type": "graph",
                                   "name": "",
                                   "x": "0",
                                   "y": "5",
                                   "width": "36",
                                   "height": "5",
                                   "view_mode": "0",
                                   "fields": [
                                       {
                                           "type": "6",
                                           "name": "graphid",
                                           "value": "1128"
                                       }
                                   ]
                               },
                               {
                                   "widgetid": "223",
                                   "type": "graph",
                                   "name": "",
                                   "x": "12",
                                   "y": "5",
                                   "width": "36",
                                   "height": "5",
                                   "view_mode": "0",
                                   "fields": [
                                       {
                                           "type": "6",
                                           "name": "graphid",
                                           "value": "1126"
                                       }
                                   ]
                               },
                               {
                                   "widgetid": "224",
                                   "type": "graph",
                                   "name": "",
                                   "x": "0",
                                   "y": "10",
                                   "width": "36",
                                   "height": "5",
                                   "view_mode": "0",
                                   "fields": [
                                       {
                                           "type": "6",
                                           "name": "graphid",
                                           "value": "1127"
                                       }
                                   ]
                               }
                           ]
                       }
                   ]
               }
           ],
           "id": 1
       }

另请参阅

来源

CTemplateDashboard::get() 函数位于 ui/include/classes/api/services/CTemplateDashboard.php 文件中。