graphprototype.create

Description

object graphprototype.create(object/array **graphPrototypes**)

This method allows to create new graph prototypes.

Parameters

(object/array) Graph prototypes to create.

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

ParameterTypeDescription
gitems
(required)
arrayGraph 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.

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. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  20. "id": 1
  21. }

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.