[comment]: # ({6a93039d-6a93039d})
# graphprototype.get

[comment]: # ({/6a93039d-6a93039d})

[comment]: # ({aeecab61-27b69e53})
### 説明

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

このメソッドは、指定されたパラメータに従ってグラフプロトタイプを取得することができます。

::: noteclassic
このメソッドは、すべての種類のユーザーが利用できます。メソッドの呼び出し権限は、ユーザーロールの設定で取り消すことができます。詳細は[ユーザーロール](/manual/web_interface/frontend_sections/users/user_roles)を参照してください。
:::

[comment]: # ({/aeecab61-27b69e53})

[comment]: # ({20b09c9f-de0f74af})
### パラメータ

`(object)` 目的の出力を定義するパラメータ。

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

|Parameter|[Type](/manual/api/reference_commentary#data-types)|Description|
|--|--|------|
|discoveryids|ID/array|指定されたディスカバリルールに属するグラフプロトタイプのみを返します。|
|graphids|ID/array|指定されたIDを持つグラフプロトタイプのみを返します。|
|groupids|ID/array|指定されたホストグループまたはテンプレートグループ内のホストまたはテンプレートに属するグラフプロトタイプのみを返します。|
|hostids|ID/array|指定されたホストに属するグラフプロトタイプのみを返します。|
|inherited|boolean|`true` に設定した場合、テンプレートから継承されたグラフプロトタイプのみを返します。|
|itemids|ID/array|指定されたアイテムプロトタイプを含むグラフプロトタイプのみを返します。|
|templated|boolean|`true` に設定した場合、テンプレートに属するグラフプロトタイプのみを返します。|
|templateids|ID/array|指定されたテンプレートに属するグラフプロトタイプのみを返します。|
|selectDiscoveryData|query|グラフプロトタイプのディスカバリオブジェクトデータを含む `discoveryData` プロパティを返します。グラフプロトタイプのディスカバリオブジェクトは、検出されたグラフプロトタイプを、それが検出元となったグラフプロトタイプに関連付けます。<br><br>以下のプロパティを持ちます:<br>`parent_graphid` - `(ID)` グラフの作成元となったグラフプロトタイプのID;<br>`status` - `(int)` グラフのディスカバリステータス:<br>0 - *(default)* グラフプロトタイプは検出されています。<br>1 - グラフプロトタイプはすでに検出されていません。<br>`ts_delete` - `(timestamp)` これ以上検出されないグラフプロトタイプが削除される時刻。|
|selectDiscoveryRule|query|グラフプロトタイプが属するLLDルールを含む [`discoveryRule`](/manual/api/reference/discoveryrule/object#lld-rule) プロパティを返します。|
|selectDiscoveryRulePrototype|query|グラフプロトタイプが属する親LLDルールプロトタイプを含む [`discoveryRulePrototype`](/manual/api/reference/discoveryruleprototype/object) プロパティを返します。|
|selectGraphItems|query|グラフプロトタイプで使用されるグラフアイテムを含む [`gitems`](/manual/api/reference/graphitem/object) プロパティを返します。|
|selectHostGroups|query|グラフプロトタイプが属するホストグループを含む [`hostgroups`](/manual/api/reference/hostgroup/object) プロパティを返します。|
|selectHosts|query|グラフプロトタイプが属するホストを含む [`hosts`](/manual/api/reference/host/object) プロパティを返します。|
|selectItems|query|グラフプロトタイプで使用される [アイテム](/manual/api/reference/item/object) および [アイテムプロトタイプ](/manual/api/reference/itemprototype/object) を含む `items` プロパティを返します。|
|selectTemplateGroups|query|グラフプロトタイプが属するテンプレートグループを含む [`templategroups`](/manual/api/reference/templategroup/object) プロパティを返します。|
|selectTemplates|query|グラフプロトタイプが属するテンプレートを含む [`templates`](/manual/api/reference/template/object) プロパティを返します。|
|filter|object|指定されたフィルターに完全に一致する結果のみを返します。<br><br>キーがプロパティ名、値が照合対象の単一の値または値の配列であるオブジェクトを受け付けます。<br><br>`text` [data type](/manual/api/reference_commentary#data-types) のプロパティはサポートしていません。<br><br>追加のプロパティをサポートしています:<br>`host` - グラフプロトタイプが属するホストの技術名;<br>`hostid` - グラフプロトタイプが属するホストのID。|
|sortfield|string/array|指定されたプロパティで結果をソートします。<br><br>指定可能な値: `graphid`, `name`, `graphtype`, `discovered`.|
|countOutput|boolean|これらのパラメータは [reference commentary](/manual/api/reference_commentary#common-get-method-parameters) で説明されています。|
|editable|boolean|^|
|excludeSearch|boolean|^|
|limit|integer|^|
|output|query|^|
|preservekeys|boolean|^|
|search|object|^|
|searchByAny|boolean|^|
|searchWildcardsEnabled|boolean|^|
|sortorder|string/array|^|
|startSearch|boolean|^|

[comment]: # ({/20b09c9f-de0f74af})

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

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

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

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

[comment]: # ({b41637d2-b41637d2})
#### LLD ルールから graph prototypes を取得する

LLD ルールからすべての graph prototypes を取得します。

Request:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "graphprototype.get",
    "params": {
        "output": "extend",
        "discoveryids": "27426"
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Response:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": [
        {
            "graphid": "1017",
            "parent_itemid": "27426",
            "name": "Disk space usage {#FSNAME}",
            "width": "600",
            "height": "340",
            "yaxismin": "0.0000",
            "yaxismax": "0.0000",
            "templateid": "442",
            "show_work_period": "0",
            "show_triggers": "0",
            "graphtype": "2",
            "show_legend": "1",
            "show_3d": "1",
            "percent_left": "0.0000",
            "percent_right": "0.0000",
            "ymin_type": "0",
            "ymax_type": "0",
            "ymin_itemid": "0",
            "ymax_itemid": "0",
            "discover": "0"
        }
    ],
    "id": 1
}
```

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

[comment]: # ({117a4fa9-62edff03})
#### LLDルールからグラフプロトタイプを取得する

LLDルールからすべてのグラフプロトタイプを取得します。

[リクエスト](/manual/api#performing-requests):

```json
{
    "jsonrpc": "2.0",
    "method": "graphprototype.get",
    "params": {
        "output": "extend",
        "discoveryids": "27426"
    },
    "id": 1
}
```

レスポンス:

```json
{
    "jsonrpc": "2.0",
    "result": [
        {
            "graphid": "1017",
            "name": "Disk space usage {#FSNAME}",
            "width": "600",
            "height": "340",
            "yaxismin": "0.0000",
            "yaxismax": "0.0000",
            "templateid": "442",
            "show_work_period": "0",
            "show_triggers": "0",
            "graphtype": "2",
            "show_legend": "1",
            "show_3d": "1",
            "percent_left": "0.0000",
            "percent_right": "0.0000",
            "ymin_type": "0",
            "ymax_type": "0",
            "ymin_itemid": "0",
            "ymax_itemid": "0",
            "flags": "2"
            "discover": "0"
        }
    ],
    "id": 1
}
```

[comment]: # ({/117a4fa9-62edff03})

[comment]: # ({7b8d40e8-e4f96e80})
### 関連項目

-   [ディスカバリルール](/manual/api/reference/discoveryrule/object#discovery-rule)
-   [グラフアイテム](/manual/api/reference/graphitem/object#graph-item)
-   [アイテム](/manual/api/reference/item/object#item)
-   [ホスト](/manual/api/reference/host/object#host)
-   [ホストグループ](/manual/api/reference/hostgroup/object#host-group)
-   [テンプレート](/manual/api/reference/template/object#template)
-   [テンプレートグループ](/manual/api/reference/templategroup/object#template-group)

[comment]: # ({/7b8d40e8-e4f96e80})

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

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

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