integer/array httptest.get(object parameters)
此方法允许根据给出的参数检索Web场景。
此方法适用于任何类型的用户。可以在用户角色设置中撤销调用该方法的权限。更多信息请查看 用户角色。
(object)
定义所需输出的参数。
该方法支持以下参数。
参数 | 类型 | 描述 |
---|---|---|
groupids | ID/数组 | 仅返回属于指定主机组的Web场景。 |
hostids | ID/数组 | 仅返回属于指定主机的Web场景。 |
httptestids | ID/数组 | 仅返回具有指定ID的Web场景。 |
inherited | 布尔值 | 如果设置为true ,仅返回从模板继承的Web场景。 |
monitored | 布尔值 | 如果设置为true ,仅返回属于受监控主机的已启用Web场景。 |
templated | 布尔值 | 如果设置为true ,仅返回属于模板的Web场景。 |
templateids | ID/数组 | 仅返回属于指定模板的Web场景。 |
expandName | 标记 | 展开Web场景名称中的宏。 |
expandStepName | 标记 | 展开场景步骤名称中的宏。 |
evaltype | 整数 | 标签搜索规则。 可能的值: 0 - (默认)And/Or; 2 - Or。 |
tags | 数组 | 仅返回具有给定标签的Web场景。根据操作符值,精确匹配标签或标签值的大小写敏感或不敏感搜索。 格式: [{"tag": "<tag>", "value": "<value>", "operator": "<operator>"}, ...] 。空数组返回所有Web场景。 可能的操作符类型: 0 - (默认)Like; 1 - Equal; 2 - Not like; 3 - Not equal 4 - Exists; 5 - Not exists。 |
selectHosts | 查询 | 作为数组返回Web场景所属的主机,在hosts 属性中,格式参照hosts 。 |
selectSteps | 查询 | 在steps 属性中返回Web场景步骤,格式参照steps 。支持 count 。 |
selectTags | 查询 | 在tags 属性中返回Web场景标签,格式参照tags 。 |
sortfield | 字符串/数组 | 根据给定属性对结果进行排序。 可能的值: httptestid ,name 。 |
countOutput | 布尔值 | 这些参数在参考说明中有描述。 |
editable | 布尔值 | |
excludeSearch | 布尔值 | |
filter | 对象 | |
limit | 整数 | |
output | 查询 | |
preservekeys | 布尔值 | |
search | 对象 | |
searchByAny | 布尔值 | |
searchWildcardsEnabled | 布尔值 | |
sortorder | 字符串/数组 | |
startSearch | 布尔值 |
(integer/array)
返回以下任一值:
countOutput
参数,则返回检索到的对象的数量。检索关于Web场景“4”的所有数据。
请求:
{
"jsonrpc": "2.0",
"method": "httptest.get",
"params": {
"output": "extend",
"selectSteps": "extend",
"httptestids": "9"
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
响应:
{
"jsonrpc": "2.0",
"result": [
{
"httptestid": "9",
"name": "Homepage check",
"nextcheck": "0",
"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
}
ui/include/classes/api/services/CHttpTest.php 中的 CHttpTest::get()。