[comment]: # translation:outdated

[comment]: # ({f53ff4b2-f53ff4b2})
# 获取

[comment]: # ({/f53ff4b2-f53ff4b2})

[comment]: # ({ea4b34b2-ebdc9145})

### 描述

`integer/array templatedashboard.get(object parameters)`

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

::: noteclassic
这个方法任何用户类型都可以使用。在用户角色设置中可以撤销调用该方法的权限。查看 [用户角色](/manual/web_interface/frontend_sections/users/user_roles)获取更多信息。
:::

[comment]: # ({/ea4b34b2-ebdc9145})

[comment]: # ({e9fd2251-4ba697bd})

### 参数

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

这个方法支持下列参数。

|参数|[类型](/manual/api/reference_commentary#数据类型)|描述|
|--|--|------|
|dashboardids|ID/array|仅返回具有指定 ID 的模版仪表盘。|
|templateids|ID/array|仅返回属于指定模版的模版仪表盘。|
|selectPages|query|返回一个包含模版仪表盘页面的 [`pages`](/manual/api/reference/templatedashboard/object#模版仪表盘页面) 属性，并按正确的顺序排列。|
|sortfield|string/array|按照指定的属性对结果进行排序。<br><br>可能的值: `dashboardid`, `name`.|
|countOutput|boolean|这些参数在所有 `get` 方法中都是通用的，在[参考说明](/manual/api/reference_commentary#常用的-get-方法参数)中有详细描述。|
|editable|boolean|^|
|excludeSearch|boolean|^|
|filter|object|^|
|limit|integer|^|
|output|query|^|
|preservekeys|boolean|^|
|search|object|^|
|searchByAny|boolean|^|
|searchWildcardsEnabled|boolean|^|
|sortorder|string/array|^|
|startSearch|boolean|^|

[comment]: # ({/e9fd2251-4ba697bd})

[comment]: # ({7223bab1-7223bab1})
### 返回值
`(integer/array)` 返回两者其一：

-   一个对象数组；
-   如果使用了'countOutput'参数，则对检索对象进行计数。

[comment]: # ({/7223bab1-7223bab1})

[comment]: # ({b41637d2-b41637d2})
### 示例

[comment]: # ({/b41637d2-b41637d2})

[comment]: # ({79bee683-62e5fb34})
#### 检索模版仪表盘

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

[请求](/manual/api#执行请求):

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

响应:

```json
{
    "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
}
```

[comment]: # ({/79bee683-62e5fb34})

[comment]: # ({1171cc63-1171cc63})
### 参阅

-   [模版仪表盘页面](object#模版仪表盘页面)
-   [模版仪表盘组件](object#模版仪表盘组件)
-   [模版仪表盘组件字段](object#模版仪表盘组件字段)

[comment]: # ({/1171cc63-1171cc63})

[comment]: # ({ddadb6a1-ddadb6a1})
### 来源

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

[comment]: # ({/ddadb6a1-ddadb6a1})
