AddDataSource

Updated at:

Adds a data source.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request syntax

POST  HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

AddModel

string

Yes

To construct the request payload, you can replicate the add data source process in the Quick BI console. On the Add Data Source page, when you click Test Connection, the restapi/datasource/detect API is called. Use this API call's payload as a template, ensuring that the provided userId and workspaceId exist in your Quick BI environment.

Important A few data source types are not supported. If your parameters match the test API request payload but the request still fails, the data source type is likely not supported by this OpenAPI.
Important Do not include the encode field in your request. This API does not support creating data sources in encrypted mode or using authentication methods that require file uploads.

{ "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", }

Sample request payloads for different data sources:

  • AnalyticDB

    {
    "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",  
        "dsType": "odps",  
        "username": "accessId",  
        "password": "accessKey",  
        "schema": "schema",  
        "project": "project name",  
        "config": {"category": "cloud", "customDriverId": null, "mcqa": true, "uploadFile": true},  
        "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 for MySQL

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

  • AnalyticDB for 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": "public",   
        "port": "80",  
        "dsType": "hologres",  
        "userId": "fec0741xxxxx061e6a951a2",  
        "config": {  
            "initialSql": "Set timezone = '-10'"   
        },  
        "workspaceId": "87f73904-xxxx-xxxx-b1ee-5a3a03a8eb45",  
        "username": "LTAI4GDxxxxxLEpsdxkW9",  
        "password": "nVvUqwPUzxxxxxA3sCqockS7"
    }
    

  • 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
    }
    

  • 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"  
            }  
        }
    }
    

  • 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 (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"
    }
    

Response elements

Element

Type

Description

Example

object

The response schema.

RequestId

string

The ID of the request.

D787E1********DF8D885

Result

string

The ID of the data source.

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

Success

boolean

Indicates whether the request succeeded. Valid values:

  • true: The request succeeded.

  • false: The request failed.

true

Examples

Success response

JSON format

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

Error codes

HTTP status code

Error code

Error message

Description

400 Internal.System.Error An internal system error occurred. An internal system error occurred.
400 Invalid.Parameter.Error The parameter is invalid:%s. invalid parameter: ${0}.
400 User.NotIn.Workspace The user is not a member of the group 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. The name cannot be longer than% s characters.
400 Database.PortInvalid.Error The database port is invalid. The database port is invalid.
400 Xengnie.TaskExecute.Error Fail to execute task %s. Fail to execute task %s.
400 VpcInstance.Info.Error Get vpc instance info error.please check vpc config %s. Get VPC instance info error.please check VPC config %s.
400 VpcInstance.Info.EmptyError Not found instance. please check vpc config and authorization %s. Not found instance. please check VPC config and authorization %s.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.