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シナリオのみを返します。
monitored boolean true に設定した場合、監視対象ホストに属する有効なWebシナリオのみを返します。
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 - (デフォルト) Contains;
1 - Equals;
2 - Does not contain;
3 - Does not equal;
4 - Exists;
5 - Does not exist.
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",
            "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
}

関連項目

ソース

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