[comment]: # ({000fdd04-000fdd04})
# graph.create

[comment]: # ({/000fdd04-000fdd04})

[comment]: # ({f389529a-f389529a})
### Description

`object graph.create(object/array graphs)`

This method allows to create new graphs.

[comment]: # ({/f389529a-f389529a})

[comment]: # ({0acd866a-28da9caa})
### Parameters

`(object/array)` Graphs to create.

Additionally to the [standard graph properties](object#graph), the
method accepts the following parameters.

|Parameter|Type|Description|
|---------|----|-----------|
|**gitems**<br>(required)|array|Graph items to be created for the graph.|

[comment]: # ({/0acd866a-28da9caa})

[comment]: # ({d64b873d-d64b873d})
### Return values

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

[comment]: # ({/d64b873d-d64b873d})

[comment]: # ({b41637d2-b41637d2})
### Examples

[comment]: # ({/b41637d2-b41637d2})

[comment]: # ({cd12048c-cd12048c})
#### Creating a graph

Create a graph with two items.

Request:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "graph.create",
    "params": {
        "name": "MySQL bandwidth",
        "width": 900,
        "height": 200,
        "gitems": [
            {
                "itemid": "22828",
                "color": "00AA00"
            },
            {
                "itemid": "22829",
                "color": "3333FF"
            }
        ]
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Response:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": {
        "graphids": [
            "652"
        ]
    },
    "id": 1
}
```

[comment]: # ({/cd12048c-cd12048c})

[comment]: # ({88266563-88266563})
### See also

-   [Graph item](/manual/api/reference/graphitem/object#graph_item)

[comment]: # ({/88266563-88266563})

[comment]: # ({798e32f7-798e32f7})
### Source

CGraph::create() in
*frontends/php/include/classes/api/services/CGraph.php*.

[comment]: # ({/798e32f7-798e32f7})
