httptest.get

Description

integer/array httptest.get(object parameters)

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

This method is available to users of any type. Permissions to call the method can be revoked in user role settings. See User roles for more information.

Parameters

(object) Parameters defining the desired output.

The method supports the following parameters.

ParameterTypeDescription
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.
evaltypeintegerRules for tag searching.

Possible values:
0 - (default) And/Or;
2 - Or.
tagsarray of objectsReturn only web scenarios with given tags. Exact match by tag and case-sensitive or case-insensitive search by tag value depending on operator value.
Format: [{“tag”: “<tag>”, “value”: “<value>”, “operator”: “<operator>”}, …].
An empty array returns all web scenarios.

Possible operator types:
0 - (default) Like;
1 - Equal;
2 - Not like;
3 - Not equal
4 - Exists;
5 - Not exists.
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.
selectTagsqueryReturn the web scenario tags in tags 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 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. "nextcheck": "0",
  8. "delay": "1m",
  9. "status": "0",
  10. "variables": [],
  11. "agent": "Zabbix",
  12. "authentication": "0",
  13. "http_user": "",
  14. "http_password": "",
  15. "hostid": "10084",
  16. "templateid": "0",
  17. "http_proxy": "",
  18. "retries": "1",
  19. "ssl_cert_file": "",
  20. "ssl_key_file": "",
  21. "ssl_key_password": "",
  22. "verify_peer": "0",
  23. "verify_host": "0",
  24. "headers": [],
  25. "steps": [
  26. {
  27. "httpstepid": "36",
  28. "httptestid": "9",
  29. "name": "Homepage",
  30. "no": "1",
  31. "url": "http://example.com",
  32. "timeout": "15s",
  33. "posts": "",
  34. "required": "",
  35. "status_codes": "200",
  36. "variables": [
  37. {
  38. "name":"{var}",
  39. "value":"12"
  40. }
  41. ],
  42. "follow_redirects": "1",
  43. "retrieve_mode": "0",
  44. "headers": [],
  45. "query_fields": []
  46. },
  47. {
  48. "httpstepid": "37",
  49. "httptestid": "9",
  50. "name": "Homepage / About",
  51. "no": "2",
  52. "url": "http://example.com/about",
  53. "timeout": "15s",
  54. "posts": "",
  55. "required": "",
  56. "status_codes": "200",
  57. "variables": [],
  58. "follow_redirects": "1",
  59. "retrieve_mode": "0",
  60. "headers": [],
  61. "query_fields": []
  62. }
  63. ]
  64. }
  65. ],
  66. "id": 1
  67. }

See also

Source

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