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シナリオを返します。

指定可能な演算子の値:
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",
            "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.