获取

Description 描述

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

The method allows to retrieve proxies according to the given parameters. 该方法允许根据给定的参数查询代理。

Parameters 参数

(object) Parameters defining the desired output. (object)定义所需输出的参数。

The method supports the following parameters. 此方法支持一下参数

ParameterTypeDescription
proxyidsstring/arrayReturn only proxies with the given IDs. 仅返回所给IDs的代理
selectHostsqueryReturn hosts monitored by the proxy in the hosts property. 返回在hosts属性中代理监控的主机
selectInterfacequeryReturn the proxy interface used by a passive proxy in the interface property.返回在interface属性中被动代理使用代理接口
sortfieldstring/arraySort the result by the given properties.

Possible values are: hostid, host and status. 根据所给的属性进行排序
\可能的值:hostid, hoststatus.
countOutputbooleanThese parameters being common for all get methods are described in detail in the reference commentary. 改参数适用于所有的get方法,详细描述是在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.

  • 一个对象数组

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

Examples 示例如下

Retrieve all proxies 检索所有的代理

Retrieve all configured proxies and their interfaces. 检索所有配置的代理和他们的接口

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. "interface": [],
  6. "host": "Active proxy",
  7. "status": "5",
  8. "lastaccess": "0",
  9. "proxyid": "30091",
  10. "description": "",
  11. "tls_connect": "1",
  12. "tls_accept": "1",
  13. "tls_issuer": "",
  14. "tls_subject": "",
  15. "tls_psk_identity": "",
  16. "tls_psk": ""
  17. },
  18. {
  19. "interface": {
  20. "interfaceid": "30109",
  21. "hostid": "30092",
  22. "useip": "1",
  23. "ip": "127.0.0.1",
  24. "dns": "",
  25. "port": "10051"
  26. ],
  27. "host": "Passive proxy",
  28. "status": "6",
  29. "lastaccess": "0",
  30. "proxyid": "30092",
  31. "description": ""
  32. }
  33. ],
  34. "id": 1
  35. }

See also

Source

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