dashboard.create
Description
object dashboard.create(object/array dashboards)
This method allows to create new dashboards.
This method is available to users of any type. Permissions to call the method can be revoked in user role settings. See User roles for more information.
Parameters
(object/array)
Dashboards to create.
Additionally to the standard dashboard properties, the method accepts the following parameters.
Parameter | Type | Description |
---|---|---|
pages | array | Dashboard pages to be created for the dashboard. Dashboard pages will be ordered in the same order as specified. Parameter behavior: - required |
users | array | Dashboard user shares to be created on the dashboard. |
userGroups | array | Dashboard user group shares to be created on the dashboard. |
Return values
(object)
Returns an object containing the IDs of the created dashboards under the dashboardids
property. The order of the returned IDs matches the order of the passed dashboards.
Examples
Creating a dashboard
Create a dashboard named “My dashboard” with one Problems widget with tags and using two types of sharing (user group and user) on a single dashboard page.
{
"jsonrpc": "2.0",
"method": "dashboard.create",
"params": {
"name": "My dashboard",
"display_period": 30,
"auto_start": 1,
"pages": [
{
"widgets": [
{
"type": "problems",
"x": 0,
"y": 0,
"width": 12,
"height": 5,
"view_mode": 0,
"fields": [
{
"type": 1,
"name": "tags.tag.0",
"value": "service"
},
{
"type": 0,
"name": "tags.operator.0",
"value": 1
},
{
"type": 1,
"name": "tags.value.0",
"value": "zabbix_server"
}
]
}
]
}
],
"userGroups": [
{
"usrgrpid": "7",
"permission": 2
}
],
"users": [
{
"userid": "4",
"permission": 3
}
]
},
"id": 1
}
Response:
{
"jsonrpc": "2.0",
"result": {
"dashboardids": [
"2"
]
},
"id": 1
}
See also
Source
CDashboard::create() in ui/include/classes/api/services/CDashboard.php.