httptest.get

Description

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

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

Parameters

(object) Parameters defining the desired output.

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 hosts that the web scenario belongs to as an array in the hosts property.
selectStepsqueryReturn web scenario steps in the steps property.

Supports count.
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 reference commentary.
editableboolean
excludeSearchboolean
filterobject
limitinteger
outputquery
preservekeysboolean
searchobject
searchByAnyboolean
searchWildcardsEnabledboolean
sortorderstring/array
startSearchboolean

Return values

(integer/array) Returns either:

  • an array of objects;

  • 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:

  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://example.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://example.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. }

See also

Source

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