获取
说明
integer/array connector.get(object parameters)
该方法允许根据给定的参数检索连接器对象。
此方法仅对“超级管理员”用户类型可用。可以在用户角色设置中撤销调用此方法的权限。 有关更多信息,请参阅用户角色。
参数
(object) 用于定义所需输出的参数。
该方法支持以下参数。
| 参数 | 类型 | 描述 |
|---|---|---|
| connectorids | ID/array | 仅返回具有给定 ID 的连接器。 |
| selectTags | query | 返回带有连接器 标签过滤器 的 tags 属性。支持 count。 |
| sortfield | string/array | 按给定属性对结果进行排序。 可选值: connectorid、name、data_type、status。 |
| countOutput | boolean | 这些参数在参考注释中进行了说明。 |
| excludeSearch | boolean | |
| filter | object | |
| limit | integer | |
| output | query | |
| preservekeys | boolean | |
| search | object | |
| searchByAny | boolean | |
| searchWildcardsEnabled | boolean | |
| sortorder | string/array | |
| startSearch | boolean |
返回值
(integer/array) 返回以下之一:
- 对象数组;
- 如果使用了
countOutput参数,则返回检索到的对象数量。
示例
获取所有连接器
检索有关所有连接器及其属性的所有数据。
请求:
{
"jsonrpc": "2.0",
"method": "connector.get",
"params": {
"output": "extend",
"selectTags": ["tag", "operator", "value"],
"preservekeys": true
},
"id": 1
}
Response:
{
"jsonrpc": "2.0",
"result": [
{
"connectorid": "1",
"name": "Export of item values",
"protocol": "0",
"data_type": "0",
"url": "{$DATA_EXPORT_VALUES_URL}",
"item_value_type": "31",
"authtype": "4",
"username": "{$DATA_EXPORT_VALUES_USERNAME}",
"password": "{$DATA_EXPORT_VALUES_PASSWORD}",
"token": "",
"max_records": "0",
"max_senders": "4",
"max_attempts": "2",
"attempt_interval": "10s",
"timeout": "10s",
"http_proxy": "{$DATA_EXPORT_VALUES_PROXY}",
"verify_peer": "1",
"verify_host": "1",
"ssl_cert_file": "{$DATA_EXPORT_VALUES_SSL_CERT_FILE}",
"ssl_key_file": "{$DATA_EXPORT_VALUES_SSL_KEY_FILE}",
"ssl_key_password": "",
"description": "",
"status": "1",
"tags_evaltype": "0",
"tags": [
{
"tag": "component",
"operator": "0",
"value": "memory"
}
]
},
{
"connectorid": "2",
"name": "Export of events",
"protocol": "0",
"data_type": "1",
"url": "{$DATA_EXPORT_EVENTS_URL}",
"item_value_type": "31",
"authtype": "5",
"username": "",
"password": "",
"token": "{$DATA_EXPORT_EVENTS_BEARER_TOKEN}",
"max_records": "0",
"max_senders": "2",
"max_attempts": "1",
"attempt_interval": "5s",
"timeout": "5s",
"http_proxy": "",
"verify_peer": "1",
"verify_host": "1",
"ssl_cert_file": "",
"ssl_key_file": "",
"ssl_key_password": "",
"description": "",
"status": "1",
"tags_evaltype": "0",
"tags": [
{
"tag": "scope",
"operator": "0",
"value": "performance"
}
]
}
],
"id": 1
}
源码位置
CConnector:get() 在 *ui/include/classes/api/services/CConnector.php文件中。