[comment]: # ({2aef6e95-2aef6e95})
# templatedashboard.create

[comment]: # ({/2aef6e95-2aef6e95})

[comment]: # ({9231e0c6-8072f2f2})
### 描述

`object templatedashboard.create(object/array templateDashboards)`

此方法允许create新的模板仪表板。

::: noteclassic
此方法仅适用于*Admin*和*Super admin*用户类型。调用该方法的权限可以在用户角色设置中撤销。更多信息请参见[User
roles](/manual/web_interface/frontend_sections/users/user_roles)。
:::

[comment]: # ({/9231e0c6-8072f2f2})

[comment]: # ({3479d924-1caae149})
### 参数

`(object/array)` 要创建的模板仪表板。

除了[标准模板仪表板属性](object#template-dashboard)之外，该方法还接受以下参数。

|Parameter|[Type](/manual/api/reference_commentary#data-types)|Description|
|--|--|------|
|pages|array|要为仪表板创建的[模板仪表板页面](/manual/api/reference/templatedashboard/object#template-dashboard-page)。仪表板页面将按照指定的顺序排列。<br><br>[参数行为](/manual/api/reference_commentary#parameter-behavior):<br>- *required*|

[comment]: # ({/3479d924-1caae149})

[comment]: # ({4bfe9ed0-4bfe9ed0})
### 返回值

`(object)` 返回一个 object，其中包含在 `dashboardids` 属性下列出的已创建模板仪表板的ID。返回的ID顺序与传入的模板仪表板顺序一致。

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

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

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

[comment]: # ({ceebc862-49684d2f})
#### 创建模板仪表板

创建一个名为“Graphs”的模板仪表板，在单个仪表板页面上包含一个 Graph 小组件。

[请求](/manual/api#performing-requests):

```json
{
    "jsonrpc": "2.0",
    "method": "templatedashboard.create",
    "params": {
        "templateid": "10318",
        "name": "Graphs",
        "pages": [
            {
                "widgets": [
                    {
                        "type": "graph",
                        "x": 0,
                        "y": 0,
                        "width": 12,
                        "height": 5,
                        "view_mode": 0,
                        "fields": [
                            {
                                "type": 6,
                                "name": "graphid",
                                "value": "1123"
                            }
                        ]
                    }
                ]

            }
        ]
    },
    "id": 1
}
```

响应：

```json
{
    "jsonrpc": "2.0",
    "result": {
        "dashboardids": [
            "32"
        ]
    },
    "id": 1
}
```

[comment]: # ({/ceebc862-49684d2f})

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

-   [模板仪表板页面](object#template-dashboard-page)
-   [模板仪表板小部件](object#template-dashboard-widget)
-   [模板仪表板小部件字段](object#template-dashboard-widget-field)

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

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

CTemplateDashboard::create() 在
*ui/include/classes/api/services/CTemplateDashboard.php* 中。

[comment]: # ({/78c6e281-78c6e281})
