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 array Template dashboard pages to be created for the dashboard. Dashboard pages will be ordered in the same order as specified.

Parameter behavior:
- required

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.

Examples

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"
                                   }
                               ]
                           }
                       ]
       
                   }
               ]
           },
           "id": 1
       }

Response:

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

See also

Source

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