该方法允许根据给定的参数检索Web场景。

    Description

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

    The method allows to retrieve web scenarios according to the given parameters.

    参数

    (object) 定义所需输出的参数。

    该方法支持以下参数。

    The method supports the following parameters.

    ParameterTypeDescription
    applicationidsstring/arrayReturn only web scenarios that belong to the given applications.
    groupidsstring/arrayReturn only web scenarios that belong to the given host groups.
    hostidsstring/arrayReturn only web scenarios that belong to the given hosts.
    httptestidsstring/arrayReturn only web scenarios with the given IDs.
    inheritedbooleanIf set to true return only web scenarios inherited from a template.
    monitoredbooleanIf set to true return only enabled web scenarios that belong to monitored hosts.
    templatedbooleanIf set to true return only web scenarios that belong to templates.
    templateidsstring/arrayReturn only web scenarios that belong to the given templates.
    expandNameflagExpand macros in the name of the web scenario.
    expandStepNameflagExpand macros in the names of scenario steps.
    selectHostsqueryReturn the host that the web scenario belongs to as an array in the hosts property.
    selectStepsqueryReturn web scenario steps in the steps property.
    sortfieldstring/arraySort the result by the given properties.

    Possible values are: httptestid and name.
    countOutputbooleanThese parameters being common for all get methods are described in detail in the .
    editableboolean
    excludeSearchboolean
    filterobject
    limitinteger
    outputquery
    preservekeysboolean
    searchobject
    searchByAnyboolean
    searchWildcardsEnabledboolean
    sortorderstring/array
    startSearchboolean

    返回值

    (integer/array) 返回:

    • 一组对象;

    • 如果已经使用“countOutput”参数,则检索到的对象的计数。

    Return values

    (integer/array) Returns either:

    • the count of retrieved objects, if the countOutput parameter has been used.

    检索网络场景

    Examples

    Retrieving a web scenario

    Retrieve all data about web scenario “4”.

    Request:

    Response:

    1. {
    2. "jsonrpc": "2.0",
    3. "result": [
    4. {
    5. "httptestid": "9",
    6. "name": "Homepage check",
    7. "applicationid": "0",
    8. "nextcheck": "0",
    9. "delay": "1m",
    10. "status": "0",
    11. "agent": "Zabbix",
    12. "http_user": "",
    13. "http_password": "",
    14. "hostid": "10084",
    15. "templateid": "0",
    16. "http_proxy": "",
    17. "retries": "1",
    18. "ssl_cert_file": "",
    19. "ssl_key_file": "",
    20. "ssl_key_password": "",
    21. "verify_peer": "0",
    22. "verify_host": "0",
    23. "headers": [],
    24. "steps": [
    25. {
    26. "httpstepid": "36",
    27. "httptestid": "9",
    28. "name": "Homepage",
    29. "no": "1",
    30. "url": "http://mycompany.com",
    31. "timeout": "15s",
    32. "posts": "",
    33. "required": "",
    34. "status_codes": "200",
    35. "variables": [
    36. {
    37. "value":"12"
    38. }
    39. "follow_redirects": "1",
    40. "retrieve_mode": "0",
    41. "headers": [],
    42. "query_fields": []
    43. },
    44. {
    45. "httpstepid": "37",
    46. "httptestid": "9",
    47. "name": "Homepage / About",
    48. "no": "2",
    49. "url": "http://mycompany.com/about",
    50. "timeout": "15s",
    51. "posts": "",
    52. "required": "",
    53. "status_codes": "200",
    54. "variables": [],
    55. "follow_redirects": "1",
    56. "retrieve_mode": "0",
    57. "headers": [],
    58. "query_fields": []
    59. }
    60. ]
    61. }
    62. ],
    63. }

    参考

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