httptest.get

説明

integer/array httptest.get(object parameters)

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

このメソッドは、すべてのタイプのユーザーが利用できます。 このメソッドを呼び出す権限は、ユーザーロールの設定で取り消すことができます。 詳細はユーザーロールを参照してください。

パラメータ

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

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

パラメータ 説明
groupids ID/array 指定したホストグループに属するWebシナリオのみを返します。
hostids ID/array 指定したホストに属するWebシナリオのみを返します。
httptestids ID/array 指定したIDを持つWebシナリオのみを返します。
inherited boolean true に設定すると、テンプレートから継承されたWebシナリオのみを返します。
inheritedTags boolean 指定した tags をテンプレート/ホスト/リンクされたテンプレートにも持つWebシナリオを返します。

指定可能な値:
true - テンプレート/ホスト/リンクされたテンプレートも指定したタグを持っている必要があります。
false - (デフォルト) テンプレート/ホスト/リンクされたテンプレートのタグは無視されます。
monitored boolean true に設定すると、監視対象ホストに属する有効なWebシナリオのみを返します。
selectInheritedTags query テンプレート/ホスト/リンクされたテンプレート上のタグを含む inheritedTags プロパティを返します。
templated boolean true に設定すると、テンプレートに属するWebシナリオのみを返します。
templateids ID/array 指定したテンプレートに属するWebシナリオのみを返します。
expandName flag Webシナリオ名内のマクロを展開します。
expandStepName flag シナリオステップ名内のマクロを展開します。
evaltype integer タグの評価方法

指定可能な値:
0 - (デフォルト) And/Or。
2 - Or。
tags array 指定したタグを持つWebシナリオのみを返します。
形式: [{"tag": "<tag>", "value": "<value>", "operator": "<operator>"}, ...]
空の配列を指定すると、すべてのWebシナリオを返します。

指定可能なoperator の値:
0 - (デフォルト) 含む。
1 - 等しい。
2 - 含まない。
3 - 等しくない。
4 - 存在する。
5 - 存在しない。
selectHosts query Webシナリオが属するホストを、hosts プロパティ内の配列として返します。
selectSteps query Webシナリオのステップを steps プロパティで返します。

count をサポートします。
selectTags query Webシナリオのタグを tags プロパティで返します。
sortfield string/array 指定したプロパティで結果をソートします。

指定可能な値: httptestid, name
countOutput boolean これらのパラメータはリファレンス解説で説明されています。
editable boolean
excludeSearch boolean
filter object
limit integer
output query
preservekeys boolean
search object
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch boolean

戻り値

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

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

Webシナリオの取得

Webシナリオ"9"のすべてのデータを取得します。

リクエスト:

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

レスポンス:

{
    "jsonrpc": "2.0",
    "result": [
        {
            "httptestid": "9",
            "name": "Homepage check",
            "delay": "1m",
            "status": "0",
            "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",
            "uuid": "",
            "headers": [],
            "variables": [],
            "steps": [
                {
                    "httpstepid": "36",
                    "httptestid": "9",
                    "name": "Homepage",
                    "no": "1",
                    "url": "http://example.com",
                    "timeout": "15s",
                    "posts": "",
                    "required": "",
                    "status_codes": "200",
                    "follow_redirects": "1",
                    "retrieve_mode": "0",
                    "post_type": "1",
                    "headers": [],
                    "variables": [
                        {
                            "name":"{var}",
                            "value":"12"
                        }
                    ],
                    "query_fields": []
                },
                {
                    "httpstepid": "37",
                    "httptestid": "9",
                    "name": "Homepage / About",
                    "no": "2",
                    "url": "http://example.com/about",
                    "timeout": "15s",
                    "posts": "",
                    "required": "",
                    "status_codes": "200",
                    "follow_redirects": "1",
                    "retrieve_mode": "0",
                    "post_type": "1",
                    "headers": [],
                    "variables": [],
                    "query_fields": []
                }
            ]
        }
    ],
    "id": 1
}

関連項目

ソース

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