[comment]: # translation:outdated

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

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

[comment]: # ({new-e0ee1e5d})
### Description

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

This method allows to create new graphs.

::: noteclassic
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](/manual/web_interface/frontend_sections/administration/user_roles)
for more information.
:::

[comment]: # ({/new-e0ee1e5d})

[comment]: # ({new-fc8b02f4})
### Parameters

`(object/array)` Graphs to create.

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

|Parameter|[Type](/manual/api/reference_commentary#data_types)|Description|
|---------|---------------------------------------------------|-----------|
|**gitems**<br>(required)|array|Graph [items](/manual/api/reference/graphitem/object) to be created for the graph.|

[comment]: # ({/new-fc8b02f4})

[comment]: # ({d64b873d-d64b873d})
### Restituisce i valori

`(object)` Restituisce un oggetto contenente gli ID dei grafici creati
sotto la proprietà `graphids`. L'ordine degli ID restituiti corrisponde a
ordine dei grafici passati.

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

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

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

[comment]: # ({new-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]: # ({/new-cd12048c})

[comment]: # ({88266563-88266563})
### Guarda anche

- [Elemento grafico](/manual/api/reference/graphitem/object#graph_item)

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

[comment]: # ({4e535c8e-4e535c8e})
### Fonte

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

[comment]: # ({/4e535c8e-4e535c8e})
