获取

说明

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

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

参数

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

该方法支持以下参数。

参数类型描述
applicationidsstring/array仅返回属于给定应用程序的Web场景。
groupidsstring/array仅返回属于给定主机组的Web方案。
hostidsstring/array仅返回属于给定主机的Web场景。
httptestidsstring/array只返回具有给定ID的Web场景。
inheritedboolean如果设置为“true”,只返回从模板继承的Web场景。
monitoredboolean如果设置为“true”,则只返回属于受监视主机的启用的Web场景。
templatedboolean如果设置为“true”,则只返回属于模板的Web场景。
templateidsstring/array仅返回属于给定模板的Web场景
expandNameflag以Web方案的名称展开宏。
expandStepNameflag在方案步骤的名称中展开宏。
selectHostsquery将网站场景所属的主机作为“hosts”属性中的数组返回.
selectStepsquerysteps属性中返回Web方案步骤。
sortfieldstring/array按照给定的属性对结果进行排序。

可能的值为:httptestidname
countOutputflag这些参数对于所有的“get”方法是常见的,在参考. 中有详细描述
editableboolean
excludeSearchflag
filterobject
limitinteger
outputquery
preservekeysflag
searchobject
searchByAnyboolean
searchWildcardsEnabledboolean
sortorderstring/array
startSearchflag

返回值

(integer/array) 返回:

  • 一组对象;

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

示例

检索网络场景

检索有关web场景“4”的所有数据。

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "httptest.get",
  4. "params": {
  5. "output": "extend",
  6. "selectSteps": "extend",
  7. "httptestids": "9"
  8. },
  9. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  10. "id": 1
  11. }

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. "variables": [],
  12. "agent": "Zabbix",
  13. "authentication": "0",
  14. "http_user": "",
  15. "http_password": "",
  16. "hostid": "10084",
  17. "templateid": "0",
  18. "http_proxy": "",
  19. "retries": "1",
  20. "ssl_cert_file": "",
  21. "ssl_key_file": "",
  22. "ssl_key_password": "",
  23. "verify_peer": "0",
  24. "verify_host": "0",
  25. "headers": [],
  26. "steps": [
  27. {
  28. "httpstepid": "36",
  29. "httptestid": "9",
  30. "name": "Homepage",
  31. "no": "1",
  32. "url": "http://mycompany.com",
  33. "timeout": "15s",
  34. "posts": "",
  35. "required": "",
  36. "status_codes": "200",
  37. "variables": [
  38. {
  39. "name":"{var}",
  40. "value":"12"
  41. }
  42. ],
  43. "follow_redirects": "1",
  44. "retrieve_mode": "0",
  45. "headers": [],
  46. "query_fields": []
  47. },
  48. {
  49. "httpstepid": "37",
  50. "httptestid": "9",
  51. "name": "Homepage / About",
  52. "no": "2",
  53. "url": "http://mycompany.com/about",
  54. "timeout": "15s",
  55. "posts": "",
  56. "required": "",
  57. "status_codes": "200",
  58. "variables": [],
  59. "follow_redirects": "1",
  60. "retrieve_mode": "0",
  61. "headers": [],
  62. "query_fields": []
  63. }
  64. ]
  65. }
  66. ],
  67. "id": 1
  68. }

参考

来源

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