获取

描述

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

该方法允许根据给定的参数查询代理。

参数

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

此方法支持一下参数。

ParameterTypeDescription
proxyidsstring/array仅返回所给ID的代理
selectHostsquery返回在hosts属性中代理监控的主机
selectInterfacequery返回在interface属性中被动代理使用代理接口
sortfieldstring/array根据所给的属性进行排序

可能的值:hostid, hoststatus.
countOutputboolean改参数适用于所有的get方法,详细描述是在reference commentary
editableboolean
excludeSearchboolean
filterobject
limitinteger
outputquery
preservekeysboolean
searchobject
searchByAnyboolean
searchWildcardsEnabledboolean
sortorderstring/array
startSearchboolean

返回值

(integer/array) Returns either:

  • 一个对象数组

  • 搜索到对象的数量,如果countOutput对象被使用

示例如下

检索所有的代理

检索所有配置的代理和他们的接口

Request:

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

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": [
  4. {
  5. "host": "Active proxy",
  6. "status": "5",
  7. "lastaccess": "0",
  8. "description": "",
  9. "tls_connect": "1",
  10. "tls_accept": "1",
  11. "tls_issuer": "",
  12. "tls_subject": "",
  13. "tls_psk_identity": "",
  14. "tls_psk": "",
  15. "proxy_address": "",
  16. "auto_compress": "0",
  17. "proxyid": "30091",
  18. "interface": []
  19. },
  20. {
  21. "host": "Passive proxy",
  22. "status": "6",
  23. "lastaccess": "0",
  24. "description": "",
  25. "tls_connect": "1",
  26. "tls_accept": "1",
  27. "tls_issuer": "",
  28. "tls_subject": "",
  29. "tls_psk_identity": "",
  30. "tls_psk": "",
  31. "proxy_address": "",
  32. "auto_compress": "0",
  33. "proxyid": "30092",
  34. "interface": {
  35. "interfaceid": "30109",
  36. "hostid": "30092",
  37. "useip": "1",
  38. "ip": "127.0.0.1",
  39. "dns": "",
  40. "port": "10051"
  41. ]
  42. }
  43. ],
  44. "id": 1
  45. }

See also

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