AddDataSource - 新增数据源连接

新增数据源连接信息。

调试

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

调试

授权信息

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

请求语法

POST  HTTP/1.1

请求参数

名称

类型

必填

描述

示例值

AddModel

string

可参考 QuickBi 数据源界面的新增数据源的逻辑,在点击【连接测试】时会触发 restapi/datasource/detect 接口,模拟该接口的传参负载,传入相同模型的 json,外加一个在在 bi 中存在的 userId 和空间 ID 即可。

重要 有小部分数据源不支持,若参数和测试接口的传参负载相同,但依旧添加不成功,则表示当前数据源类型不支持通过该 openapi 创建
重要 encode 字段请不要传参,目前 openapi 创建数据源不支持加密模式,涉及上传文件类型的认证也不支持

{ "userId": "235345xxxxx24336", "workspaceId": "235345xxxxx24336", "dsType": "postgresql", "config": { "category": "local", "customDriverId": null, "ssl": false, "uploadFile": true, "sslConfig": null }, "showName": "test", "address": "test", "port": "5432", "instance": "postgres", "schema": "public", "userName": "13****34", "password": "12****425", }

以下是部分数据源添加的请求参数 demo:

  • adb

    {
    "showName": "testadb3.0",
    "address": "",
    "port": 3306,
    "dsType": "adb",
    "username": "xxx",
    "password": "xxx",
    "schema": null,
    "instance": "test",
    "workspaceId": "xxx",
    "userId": "xxx"
    }
    

  • maxcompute

    {  
        "showName": "maxcompute",  
        "address": "http://service.xxx.xxx.com/api",  
        "port": null,  
        "dsType": "odps",  
        "username": "accessId",  
        "password": "accessKey",  
        "schema": null,  
        "instance": "project",  
        "project": "project name",  
        "config": null,  
        "workspaceId": "xxx",  
        "userId": "xxx"  
    }
    

  • hive

    {
        "showName": "test",  
        "address": "192.168.0.1",  
        "port": "10000",  
        "dsType": "hive",  
        "instance": "hive",   
        "userName": "xxx",  
        "password": "xxx",  
        "config": {  
           "category": "local"  
        },
        "workspaceId":"xxx",  
        "userId":"xxx"  
    }
    

  • gbase

    {
        "showName": "test",  
        "address": "192.168.0.1",  
        "port": "5258",  
        "dsType": "gbase",  
        "instance": "quickbi_test",  
        "username": "root",  
        "password": "root",  
        "config": {  
            "category": "local"    
        },  
        "workspaceId": "xxx",  
        "userId": "xxx"  
    } 
    

  • rds-mysql

    {
      "showName":"mysql",  
      "address":"",  
      "port": 3306,  
      "dsType":"mysql",  
      "username":"xxx",  
      "password":"xxx",  
      "schema": null,  
      "instance":"test",  
      "workspaceId":"xxx",  
      "userId":"xxx"  
    }
    

  • adb-mysql(vpc)

    {
      "dsType": "adb",
      "config": {
        "category": "cloud",
        "resource": "adb",
        "uploadFile": true
      },
      "engineType": "adb",
      "showName": "mysql",
      "address": "amvxxxxxxxxxs.com",
      "port": "3306",
      "instance": "quxxxxxxxest",
      "userName": "quixxxxxxxxxxxxst",
      "password": "Taxxxxxxxx34",
      "accessId": "LTAxxxxxxxxxxx453bo",
      "accessKey": "Jy9xxxxxxxxxxxxZ96QqtBa",
      "instanceId": "amxxxxxxxxxxxl0",
      "region": "cn-hangzhou",
      "userId": "ed3xxxxxxxxxxxxxx697b8664",
      "workspaceId": "086xxxxxxxxxxxxxxxxxcd9a62236c"
    }
    

  • hologres

    {
        "showName": "Hologres",  
        "address": "hgprecn-cn-xxxxxx-cn-shanghai.hologres.aliyuncs.com",  
        "instance": "quickbi_test",  
        "schema": "publick",   
        "port": "80",  
        "dsType": "hologres",  
        "userId": "fec0741xxxxx061e6a951a2",  
        "config": {  
            "initialSql": "Set timezone = '-10'"   
        },  
        "workspaceId": "87f73904-xxxx-xxxx-b1ee-5a3a03a8eb45",  
        "username": "LTAI4GDxxxxxLEpsdxkW9",  
        "password": "nVvUqwPUzxxxxxA3sCqockS7",
        "workspaceId":"xxx",  
        "userId":"xxx"   
    }
    

  • impala-ldap

    {  
        "workspaceId": "87f73904-xxxx-xxxx-b1ee-5a3a03a8eb45",  
        "userId": "fec0741xxxxx061e6a951a2",  
        "dsType":  "impala",  
        "config":  {  
            "category":  "local",  
            "resource":  "ecs",  
            "ssl":  false  
        },  
        "showName":  "impala-ldap",  
        "address":  "xx.xx.xx.xx",  
        "port":  "xxxx",  
        "instance":  "default",  
        "dsVersion":  "3.x",  
        "username":  "xxxxx",   
        "password":  "xxxxxxxxx",  
        "instanceId":  "i-uf6fxxxxxbt3eh6lb",  
        "noSasl":  true,
        "workspaceId":"xxx",  
        "userId":"xxx"   
    }
    

  • impala

    {
        "showName": "impala-test",   
        "address": "192.168.0.1",  
        "port": "21050",  
          "dsType": "impala",  
        "dsVersion": "3.x",   
        "instance": "test",   
        "userName": "xxx",   
        "password": "xxx",  
        "config": {  
            "category": "local",  
            "ssh" : {  
              "host": "192.168.0.2",  
              "username": "xxxx",  
              "password": "xxx",  
              "port": "22"  
            }  
        },
        "workspaceId":"xxx",  
        "userId":"xxx" 
    }
    

  • dataphin-Dataphin_odps

    {  
        "workspaceId": "87f73904-xxxx-xxxx-b1ee-5a3a03a8eb45",  
        "userId": "fec0741xxxxx061e6a951a2",  
        "dsType":  "dataphin_odps",  
        "address":  "f6c64214dc27400xxxxxx-cn-shanghai.alicloudapi.com",  
        "username":  "20xxx18",  
        "password":  "33paqqexxxxg07qzj28",  
        "instance":  "test_ds",  
        "showName":  "1_1_dataphin_odps",  
        "config":  {  
            "category":  "application",  
            "engineType":  "odps"  
        }  
    }
    

  • dataphin-Dataphin_hive

    {  
        "workspaceId": "87f73904-xxxx-xxxx-b1ee-5a3a03a8eb45",  
        "userId": "fec0741xxxxx061e6a951a2",  
        "dsType":  "dataphin_hive",  
        "address":  "f6c64214dc27400xxxxxx-cn-shanghai.alicloudapi.com",  
        "username":  "20xxx18",  
        "password":  "33paqqexxxxg07qzj28",  
        "instance":  "test_ds",  
        "showName":  "1_1_dataphin_odps",  
        "config":  {  
            "category":  "application",  
            "engineType":  "hive"  
        }  
    }
    

  • DataPhin_JDBC_public

    {  
        "workspaceId": "87f73904-xxxx-xxxx-b1ee-5a3a03a8eb45",  
        "userId": "fec0741xxxxx061e6a951a2",  
        "dsType":  "odps",  
        "config":  {  
            "engineType":  "hive",  
            "category":  "application",  
            "dataphinConfig":  {  
                "tenantId":  "305xxx306",  
                "delegationUid":  "@dataphin",  
                "accountType":  "ACCOUNT_NAME",  
                "authMode":  "DELEGATION"  
            },  
            "resource": "clb",  
            "initialSql": "Set timezone = '-10'"  
        },  
        "showName":  "DataPhin_JDBC_public",  
        "connectType": "dataphin_v2",  
        "address": "47.xxx.xxx.124",  
        "port":  "80",  
        "project": "bbb",  
        "instance":  "fxxxk_test",  
        "username":  "OIYtGZxxx7zmRpgQpB",  
        "password":  "lDbQDnUuxxxxxGsxOd1",  
        "parentDsType": "dataphin",  
        "accessId": "[3eo[x>>",  
        "accessKey": "bHipbB>>",  
        "instanceId": "nnnn",  
        "region": "cn-qingdao"  
    }
    

  • Dataphin-jdbc-private

    {  
        "workspaceId": "87f73904-xxxx-xxxx-b1ee-5a3a03a8eb45",  
        "userId": "fec0741xxxxx061e6a951a2",  
        "dsType":  "dataphin_v2",  
        "config":  {  
            "engineType":  "hive",  
            "category":  "application",  
            "dataphinConfig":  {  
                "tenantId":  "30xxxx6",  
                "authMode":  "SIMPLE"  
            },  
            "resource": "clb",  
            "initialSql": "Set timezone = '-10'"  
        },  
        "showName":  "Dataphin-jdbc-private",  
        "connectType":  "dataphin_v2",  
        "address":  "47.xxx.x4x.124",  
        "port":  "80",  
        "project": "bbb",  
        "instance":  "fxxx_test",  
        "username":  "kItowxxxxxxx2ZJr0",  
        "password":  "kSlPkmS1xxxxxx61zd4SDX",  
        "parentDsType": "dataphin",  
        "accessId": "[3eo[x>>",  
        "accessKey": "bHipbB>>",  
        "instanceId": "nnnn",  
        "region": "cn-qingdao"  
    }
    

  • SQL Server(vpc)

    {
      "dsType": "sqlserver",
      "config": {
        "category": "local",
        "resource": "ecs",
        "uploadFile": true
      },
      "showName": "sqlserver",
      "address": "rm-bp11xxxxxxncs.com",
      "port": "1433",
      "instance": "quixxxxxest",
      "schema": "dbo",
      "userName": "quicxxxtest",
      "password": "Taoxxxx34",
      "accessId": "LTAI5xxxxxxxKLjjj",
      "accessKey": "rOYdkxxxxxxxSeel1",
      "instanceId": "rm-xxxxx502ndmq",
      "region": "cn-huhehaote",
      "userId": "ed33389xxxx6697b8664",
      "workspaceId": "08634xxxx4cd9a62236c"
    }
    

返回参数

名称

类型

描述

示例值

object

Schema of Response

RequestId

string

请求 ID。

D787E1********DF8D885

Result

string

数据源 ID。

472b241b-c651-****-****-ee719d6faf45

Success

boolean

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

  • true:请求成功

  • false:请求失败

true

示例

正常返回示例

JSON格式

{
  "RequestId": "D787E1********DF8D885",
  "Result": "472b241b-c651-****-****-ee719d6faf45",
  "Success": true
}

错误码

HTTP status code

错误码

错误信息

描述

400 Internal.System.Error An internal system error occurred. 系统内部异常。
400 Invalid.Parameter.Error The parameter is invalid:%s. 无效参数%s。
400 User.NotIn.Workspace The user is not a member of the group workspace. 该用户不在群空间中。
400 Invalid.Workspace The workspace is not owned by the organization. 该空间不在组织内。
400 Name.RegularExpression.Error Name format validation failed. 名称格式验证失败。
400 NameExceeded.MaxLength.Error The name cannot exceed %s characters in length. 名称长度不能超过%s个字符。
400 Database.PortInvalid.Error The database port is invalid. 数据库端口无效。
400 Xengnie.TaskExecute.Error Fail to execute task %s. 任务执行失败 %s。

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

变更历史

更多信息,参考变更详情