This is a translation of the original English documentation page. Help us make it better.

templatedashboard.create

Description

object templatedashboard.create(object/array templateDashboards)

This method allows to create new template dashboards.

This method is only available to Admin and Super admin user types. Permissions to call the method can be revoked in user role settings. See User roles for more information.

Parameters

(object/array) Template dashboards to create.

Additionally to the standard template dashboard properties, the method accepts the following parameters.

Parameter Type Description
pages
(required)
array Template dashboard pages to be created for the dashboard. Dashboard pages will be ordered in the same order as specified. At least one dashboard page object is required for pages property.

Return values

(object) Returns an object containing the IDs of the created template dashboards under the dashboardids property. The order of the returned IDs matches the order of the passed template dashboards.

Приклади

Creating a template dashboard

Create a template dashboard named “Graphs” with one Graph widget on a single dashboard page.

Request:

{
           "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"
                                   }
                               ]
                           }
                       ]
                       
                   }
               ]
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

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

See also

Джерело

CTemplateDashboard::create() у ui/include/classes/api/services/CTemplateDashboard.php.