connector.update

描述

object connector.update(object/array connectors)

此方法用于 update 现有的连接器。

此方法仅适用于 超级管理员 用户类型。可以在用户角色设置中撤销调用该方法的权限。 更多信息请参见 User roles

参数

(object/array) 要更新的连接器属性。

每个连接器都必须定义 connectorid 属性,所有其他属性都是可选的。
仅更新传递的属性,其余属性保持不变。

除了 连接器 外,该方法还接受以下参数。

参数 数据类型 描述
tags array 连接器 标签过滤器,用于替换当前标签过滤器。

返回值

(object) 返回一个 object,其中包含在 connectorids 属性下列出的已更新连接器的 ID。

示例

更改HTTP认证类型

将连接器 ID 为 "3" 的 HTTP 认证类型更改为 Bearer。

执行请求:

{  "jsonrpc": "2.0",  "method": "connector.update",  "params": {  "connectorid": 3,  "authtype": 5,  "token": "{$DATA_EXPORT_BEARER_TOKEN}"  },  "id": 1 }

响应:

{  "jsonrpc": "2.0",  "result": {  "connectorids": [  "3"  ]  },  "id": 1 }

更新标签过滤器

更改ID为"5"的连接器的标签过滤器。

执行请求:

{  "jsonrpc": "2.0",  "method": "connector.update",  "params": [  {  "connectorid": 5,  "tags_evaltype": 2,  "tags": [  {  "tag": "service",  "operator": 0,  "value": "mysqld"  },  {  "tag": "error",  "operator": 12,  "value": ""  }  ]  }  ],  "id": 1 }

响应:

{  "jsonrpc": "2.0",  "result": {  "connectorids": [  "5"  ]  },  "id": 1 }

来源

CConnector::update() 在 ui/include/classes/api/services/CConnector.php 中。