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.