UpdateDataSource - 修改数据源配置

修改数据源配置。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息

当前API暂无授权信息透出。

请求参数

名称类型必填描述示例值
UpdateModelstring

传参参考示例值的 JSON 样式,其中参数解析如下:

  • dsId -- 必传 -- 数据源 ID
  • userId -- 非必传 -- 修改数据源的用户身份,quickbi 的 userId,如果传了则以当前 userid 修改
  • dsType -- 必传 -- 数据源类型,不允许修改,传该数据源类型即可。
  • showName -- 非必传 -- 数据源显示名称。
  • address -- 非必传 -- 数据库连接串地址(域名或 ip)
  • port -- 非必传 --端口
  • schema -- 非必传 -- 数据库 schema,仅对支持 schema 的数据库需要设置,示例:sqlserver 默认使用 dbo;mysql 不支持 schema
  • instance -- 非必传 -- 实例 db
  • username -- 非必传 -- 数据库用户名/ak
  • password -- 非必传 -- 数据库密钥
  • config -- 非必传 -- 数据库额外配置项,注意,该数据要和创建时不同数据源的不同 config 传参保持一致,不做修改的字段无需传参,传了参数的字段默认改为传参为准(包括空字符串)。
{ "schema": "schema", "userId":"S*****46345", "password": "Ta****34", "showName": "数据源编辑测试修改名称", "address": "11*****.55", "instance": "quickbi_test", "dsId": "34d6d******3ca8ac267", "port": "3306", "dsType": "mysql", "username": "root", "config": { "initialSql": "Set timezone = '-10'" } }

示例代码: @Test

public void UpdateDataSource () throws SDKException, ClientException {
    UpdateDataSourceRequest request = new UpdateDataSourceRequest();
    HashMap<String,Object> updateModel = new HashMap<>();
    updateModel.put("dsId", "342e*******455");
    updateModel.put("userId","74f5*****20ebf278c8");
    updateModel.put("dsType", "impala");
    updateModel.put("address", "12***22");
    updateModel.put("instance", "default");
    updateModel.put("showName", "wk***修改");
    request.setUpdateModel(JSONObject.toJSONString(updateModel));
    System.out.println(JSONObject.toJSONString(updateModel));
    request.setSysConnectTimeout(60000);request.setSysReadTimeout(60000);
    UpdateDataSourceResponse  acsResponse = getPopAPIClient("test").getAcsResponse(request);

    System.out.println(JSONObject.toJSONString(acsResponse.getResult()));
}

返回参数

名称类型描述示例值
object

Schema of Response

RequestIdstring

请求 ID。

D787E1A***********5DF8D885
Resultboolean

接口执行结果。取值范围:

  • true:请求成功
  • false:请求失败
true
Successboolean

是否请求成功。取值范围:

  • true:请求成功
  • false:请求失败
true

示例

正常返回示例

JSON格式

{
  "RequestId": "D787E1A***********5DF8D885",
  "Result": true,
  "Success": true
}

错误码

HTTP status code错误码错误信息描述
400Internal.System.ErrorAn internal system error occurred.系统内部异常。
400Invalid.Parameter.ErrorThe parameter is invalid:%s.无效参数%s。
400User.NotIn.WorkspaceThe user is not a member of the group workspace.该用户不在群空间中。
400NoPermissionTo.Operate.ObjectYou are not authorized to operate the objects.您无权操作这些对象。
400DatasourceId.IsNull.ErrorYou must select a data source before selecting the table.必须选择数据源之后再选择表。
400Datasource.NotFound.ErrorThe specified data source does not exist: %s.数据源不存在:%s。
400Name.RegularExpression.ErrorName format validation failed.名称格式验证失败。
400NameExceeded.MaxLength.ErrorThe name cannot exceed %s characters in length.名称长度不能超过%s个字符。
400Database.PortInvalid.ErrorThe database port is invalid.数据库端口无效。

访问错误中心查看更多错误码。