[comment]: # translation:outdated

[comment]: # ({43e64f56-43e64f56})
# graphitem.get

[comment]: # ({/43e64f56-43e64f56})

[comment]: # ({ae8b1444-fe22ea70})
### 説明

`integer/array graphitem.get(object parameters)`

このメソッドは、与えられたパラメータに従ってグラフアイテムを取得することができます。

::: noteclassic
このメソッドは、どのタイプのユーザーでも利用可能です。このメソッドを呼び出す許可は、ユーザーロール設定で<br>
取り消すことができます。詳しくは [User roles](/manual/web_interface/frontend_sections/administration/user_roles) をご覧ください。
:::

[comment]: # ({/ae8b1444-fe22ea70})

[comment]: # ({1f02a32a-d30698ba})
### パラメータ

`(object)` 希望する出力を定義するパラメータ

このメソッドは、以下のパラメータをサポートしています。

|パラメータ|[Type](/manual/api/reference_commentary#data_types)|説明|
|--|--|------|
|graphids|string/array|Return only graph items that belong to the given graphs.|
|itemids|string/array|Return only graph items with the given item IDs.|
|type|integer|Return only graph items with the given type.<br><br>Refer to the [graph item object page](object#graph_item) for a list of supported graph item types.|
|selectGraphs|query|Return a [graphs](/manual/api/reference/graph/object) property with an array of graphs that the item belongs to.|
|sortfield|string/array|Sort the result by the given properties.<br><br>Possible values are: `gitemid`.|
|countOutput|boolean|These parameters being common for all `get` methods are described in detail in the [reference commentary](/manual/api/reference_commentary#common_get_method_parameters) page.|
|editable|boolean|^|
|limit|integer|^|
|output|query|^|
|preservekeys|boolean|^|
|sortorder|string/array|^|

[comment]: # ({/1f02a32a-d30698ba})

[comment]: # ({7223bab1-7223bab1})
### 戻り値

`(integer/array)` 次のいずれかを返します:

-   オブジェクトの配列
-   `countOutput`パラメーターが使用されている場合、取得したオブジェクトの数

[comment]: # ({/7223bab1-7223bab1})

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

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

[comment]: # ({d7d0ce06-37da5f20})
#### グラフからグラフアイテムを取得する

グラフで使用されているすべてのグラフアイテムを、item やホストに関する追加情報とともに取得します。

Request:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "graphitem.get",
    "params": {
        "output": "extend",
        "graphids": "387"
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Response:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": [
        {
            "gitemid": "1242",
            "graphid": "387",
            "itemid": "22665",
            "drawtype": "1",
            "sortorder": "1",
            "color": "FF5555",
            "yaxisside": "0",
            "calc_fnc": "2",
            "type": "0",
            "key_": "system.cpu.util[,steal]",
            "hostid": "10001",
            "flags": "0",
            "host": "Linux"
        },
        {
            "gitemid": "1243",
            "graphid": "387",
            "itemid": "22668",
            "drawtype": "1",
            "sortorder": "2",
            "color": "55FF55",
            "yaxisside": "0",
            "calc_fnc": "2",
            "type": "0",
            "key_": "system.cpu.util[,softirq]",
            "hostid": "10001",
            "flags": "0",
            "host": "Linux"
        },
        {
            "gitemid": "1244",
            "graphid": "387",
            "itemid": "22671",
            "drawtype": "1",
            "sortorder": "3",
            "color": "009999",
            "yaxisside": "0",
            "calc_fnc": "2",
            "type": "0",
            "key_": "system.cpu.util[,interrupt]",
            "hostid": "10001",
            "flags": "0",
            "host": "Linux"
        }
    ],
    "id": 1
}
```

[comment]: # ({/d7d0ce06-37da5f20})

[comment]: # ({09a26e71-09a26e71})
### 参照

-   [Graph](/manual/api/reference/graph/object#graph)

[comment]: # ({/09a26e71-09a26e71})

[comment]: # ({8d13cada-8d13cada})
### ソース

CGraphItem::get() in *ui/include/classes/api/services/CGraphItem.php*.

[comment]: # ({/8d13cada-8d13cada})
