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.

ParameterTypeDescription
gitemsarrayGraph 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:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "graphprototype.create",
  4. "params": {
  5. "name": "Disk space usage {#FSNAME}",
  6. "width": 900,
  7. "height": 200,
  8. "gitems": [
  9. {
  10. "itemid": "22828",
  11. "color": "00AA00"
  12. },
  13. {
  14. "itemid": "22829",
  15. "color": "3333FF"
  16. }
  17. ]
  18. },
  19. "id": 1
  20. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "graphids": [
  5. "652"
  6. ]
  7. },
  8. "id": 1
  9. }

See also

Source

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