graphprototype.create

Description

object graphprototype.create(object/array graphPrototypes)

This method allows to create new graph prototypes.

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) Graph prototypes to create.

Additionally to the standard graph prototype properties, the method accepts the following parameters.

Parameter Type Description
gitems array Graph items to be created for the graph prototypes. Graph items can reference both items and item prototypes, but at least one item prototype must be present.

Parameter behavior:
- required

Return values

(object) Returns an object containing the IDs of the created graph prototypes under the graphids property. The order of the returned IDs matches the order of the passed graph prototypes.

Examples

Creating a graph prototype

Create a graph prototype with two items.

Request:

{
           "jsonrpc": "2.0",
           "method": "graphprototype.create",
           "params": {
               "name": "Disk space usage {#FSNAME}",
               "width": 900,
               "height": 200,
               "gitems": [
                   {
                       "itemid": "22828",
                       "color": "00AA00"
                   },
                   {
                       "itemid": "22829",
                       "color": "3333FF"
                   }
               ]
           },
           "id": 1
       }
Copy
✔ Copied

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "graphids": [
                   "652"
               ]
           },
           "id": 1
       }
Copy
✔ Copied

See also

Source

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

To toggle search highlight, press Ctrl+Alt+H
Have an improvement suggestion for this page? Select the text that could be improved and press Ctrl+Enter to send it to the editors.