[comment]: # ({c7f20528-f9e8f670})
# templategroup.get

[comment]: # ({/c7f20528-f9e8f670})

[comment]: # ({97635317-b5ff62ed})
### 説明

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

このメソッドは、指定されたパラメーターに従ってテンプレートグループを取得できます。

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

[comment]: # ({/97635317-b5ff62ed})

[comment]: # ({6d7dd702-6102edd8})
### パラメータ

`(object)` 必要な出力を定義するパラメータです。

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

|Parameter|[Type](/manual/api/reference_commentary#data-types)|Description|
|--|--|------|
|graphids|ID/array|指定したグラフを含むテンプレートを持つテンプレートグループのみを返します。|
|groupids|ID/array|指定したテンプレートグループIDを持つテンプレートグループのみを返します。|
|templateids|ID/array|指定したテンプレートを含むテンプレートグループのみを返します。|
|triggerids|ID/array|指定したトリガーを含むテンプレートを持つテンプレートグループのみを返します。|
|with\_graphs|boolean|グラフを含むテンプレートを持つテンプレートグループのみを返します。|
|with\_graph\_prototypes|boolean|グラフプロトタイプを含むテンプレートを持つテンプレートグループのみを返します。|
|with\_httptests|boolean|Web監視を含むテンプレートを持つテンプレートグループのみを返します。|
|with\_items|boolean|アイテムを含むテンプレートを持つテンプレートグループのみを返します。<br><br>`with_simple_graph_items` パラメータより優先されます。|
|with\_item\_prototypes|boolean|アイテムプロトタイプを含むテンプレートを持つテンプレートグループのみを返します。<br><br>`with_simple_graph_item_prototypes` パラメータより優先されます。|
|with\_simple\_graph\_item\_prototypes|boolean|作成が有効で、かつ数値型の情報タイプを持つアイテムプロトタイプを含むテンプレートを持つテンプレートグループのみを返します。|
|with\_simple\_graph\_items|boolean|数値アイテムを含むテンプレートを持つテンプレートグループのみを返します。|
|with\_templates|boolean|テンプレートを含むテンプレートグループのみを返します。|
|with\_triggers|boolean|トリガーを含むテンプレートを持つテンプレートグループのみを返します。|
|selectTemplates|query|テンプレートグループに属するテンプレートを含む [`templates`](/manual/api/reference/template/object) プロパティを返します。<br><br>`count` をサポートします。|
|limitSelects|integer|サブセレクトで返されるレコード数を制限します。<br><br>以下のサブセレクトに適用されます:<br>`selectTemplates` - 結果は `template` でソートされます。|
|sortfield|string/array|指定したプロパティで結果をソートします。<br><br>指定可能な値: `groupid`, `name`。|
|countOutput|boolean|これらのパラメータは [reference commentary](/manual/api/reference_commentary#common-get-method-parameters) で説明されています。|
|editable|boolean|^|
|excludeSearch|boolean|^|
|filter|object|^|
|limit|integer|^|
|output|query|^|
|preservekeys|boolean|^|
|search|object|^|
|searchByAny|boolean|^|
|searchWildcardsEnabled|boolean|^|
|sortorder|string/array|^|
|startSearch|boolean|^|

[comment]: # ({/6d7dd702-6102edd8})

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

`(integer/array)` 以下のいずれかを返します。

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

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

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

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

[comment]: # ({3ca44c43-c32b9462})
#### 名前によるデータの取得

"Templates/Databases"と"Templates/Modules"という名前の二つのテンプレートグループについて、全てのデータを取得します。

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

```json
{
    "jsonrpc": "2.0",
    "method": "templategroup.get",
    "params": {
        "output": "extend",
        "filter": {
            "name": [
                "Templates/Databases",
                "Templates/Modules"
            ]
        }
    },
    "id": 1
}
```

レスポンス :

```json
{
    "jsonrpc": "2.0",
    "result": [
        {
            "groupid": "13",
            "name": "Templates/Databases",
            "uuid": "748ad4d098d447d492bb935c907f652f"
        },
        {
            "groupid": "8",
            "name": "Templates/Modules",
            "uuid": "57b7ae836ca64446ba2c296389c009b7"
        }
    ],
    "id": 1
}
```

[comment]: # ({/3ca44c43-c32b9462})

[comment]: # ({f3cd9368-585b4960})
### 参照

-   [Template](/manual/api/reference/template/object#template)

[comment]: # ({/f3cd9368-585b4960})

[comment]: # ({9f94aa1e-31239fd5})
### ソース

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

[comment]: # ({/9f94aa1e-31239fd5})
