[comment]: # ({7f8cd3a3-7f8cd3a3})
# httptest.get

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

[comment]: # ({70e0f3e6-96cbc36d})
### 説明

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

このメソッドでは、指定されたパラメータに従ってWebシナリオを取得できます。

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

[comment]: # ({/70e0f3e6-96cbc36d})

[comment]: # ({6422f5ac-7be2c19f})
### パラメータ

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

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

|Parameter|[Type](/manual/api/reference_commentary#data-types)|Description|
|--|--|------|
|groupids|ID/array|指定したホストグループに属するWebシナリオのみを返します。|
|hostids|ID/array|指定したホストに属するWebシナリオのみを返します。|
|httptestids|ID/array|指定したIDを持つWebシナリオのみを返します。|
|inherited|boolean|`true` に設定した場合、テンプレートから継承されたWebシナリオのみを返します。|
|monitored|boolean|`true` に設定した場合、監視対象ホストに属する有効なWebシナリオのみを返します。|
|templated|boolean|`true` に設定した場合、テンプレートに属するWebシナリオのみを返します。|
|templateids|ID/array|指定したテンプレートに属するWebシナリオのみを返します。|
|expandName|flag|Webシナリオ名内のマクロを展開します。|
|expandStepName|flag|シナリオステップ名内のマクロを展開します。|
|evaltype|integer|タグの[評価方法](/manual/web_interface/frontend_sections/data_collection/web#using-filter)。<br><br>使用可能な値:<br>0 - *(デフォルト)* And/Or;<br>2 - Or.|
|tags|array|指定したタグを持つWebシナリオのみを返します。<br>形式: `[{"tag": "<tag>", "value": "<value>", "operator": "<operator>"}, ...]`。<br>空の配列を指定すると、すべてのWebシナリオを返します。<br><br>使用可能な[operator](/manual/web_interface/frontend_sections/data_collection/web#using-filter)の値:<br>0 - *(デフォルト)* Contains;<br>1 - Equals;<br>2 - Does not contain;<br>3 - Does not equal;<br>4 - Exists;<br>5 - Does not exist.|
|selectHosts|query|Webシナリオが属するホストを、[`hosts`](/manual/api/reference/host/object)プロパティに配列として返します。|
|selectSteps|query|Webシナリオのステップを、[`steps`](/manual/api/reference/httptest/object#scenario-step)プロパティに返します。<br><br>`count` をサポートします。|
|selectTags|query|Webシナリオのタグを、[`tags`](/manual/api/reference/httptest/object#web-scenario-tag)プロパティに返します。|
|sortfield|string/array|指定したプロパティで結果を並べ替えます。<br><br>使用可能な値: `httptestid`, `name`。|
|countOutput|boolean|これらのパラメータについては、[リファレンス解説](/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]: # ({/6422f5ac-7be2c19f})

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

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

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

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

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

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

[comment]: # ({300b343b-c93618d6})
#### Webシナリオの取得

Webシナリオ「9」に関するすべてのデータを取得します。

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

```json
{
    "jsonrpc": "2.0",
    "method": "httptest.get",
    "params": {
        "output": "extend",
        "selectSteps": "extend",
        "httptestids": "9"
    },
    "id": 1
}
```

レスポンス:

```json
{
    "jsonrpc": "2.0",
    "result": [
        {
            "httptestid": "9",
            "name": "Homepage check",
            "delay": "1m",
            "status": "0",
            "variables": [],
            "agent": "Zabbix",
            "authentication": "0",
            "http_user": "",
            "http_password": "",
            "hostid": "10084",
            "templateid": "0",
            "http_proxy": "",
            "retries": "1",
            "ssl_cert_file": "",
            "ssl_key_file": "",
            "ssl_key_password": "",
            "verify_peer": "0",
            "verify_host": "0",
            "headers": [],
            "steps": [
                {
                    "httpstepid": "36",
                    "httptestid": "9",
                    "name": "Homepage",
                    "no": "1",
                    "url": "http://example.com",
                    "timeout": "15s",
                    "posts": "",
                    "required": "",
                    "status_codes": "200",
                    "variables": [
                        {
                            "name":"{var}",
                            "value":"12"
                        }
                    ],
                    "follow_redirects": "1",
                    "retrieve_mode": "0",
                    "headers": [],
                    "query_fields": []
                },
                {
                    "httpstepid": "37",
                    "httptestid": "9",
                    "name": "Homepage / About",
                    "no": "2",
                    "url": "http://example.com/about",
                    "timeout": "15s",
                    "posts": "",
                    "required": "",
                    "status_codes": "200",
                    "variables": [],
                    "follow_redirects": "1",
                    "retrieve_mode": "0",
                    "headers": [],
                    "query_fields": []
                }
            ]
        }
    ],
    "id": 1
}
```

[comment]: # ({/300b343b-c93618d6})

[comment]: # ({2906645b-ce685d69})
### 関連項目

-   [ホスト](/manual/api/reference/host/object#host)
-   [シナリオステップ](object#scenario-step)

[comment]: # ({/2906645b-ce685d69})

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

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

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