AddDataSource

Updated at:

Creates a data source connection.

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

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

quickbi-public:AddDataSource

create

*All Resource

*

None None

Request syntax

POST  HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

AddModel

string

Yes

You can refer to the logic of adding a data source on the Quick BI data source page. When you click Test Connection, the restapi/datasource/detect API operation is triggered. Simulate the request payload of this API operation by passing a JSON object of the same model, along with a valid userId and workspace ID in Quick BI. In version 7.1, the userAsOwner parameter is added. If you set this parameter to true, the data source is created as the specified userId.

Important A small number of data sources are not supported. If the parameters are the same as the request payload of the test API operation but the data source still fails to be added, the current data source type does not support creation through this API operation.
Important Do not pass the encode parameter. Currently, this API operation does not support encryption mode for creating data sources, and authentication that involves uploading files is not supported.

{ "userId": "235345xxxxx24336", "userAsOwner":true, "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", }

The following are sample request parameters for adding specific data sources:

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

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

The request ID.

D787E1********DF8D885

Result

string

The data source ID.

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

Success

boolean

Indicates whether the request is successful. Valid values:

  • true: The request is successful.

  • false: The request fails.

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. The workspace is not in the organization.
400 Name.RegularExpression.Error Name format validation failed. The 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.
400 Data.Query.Error Datasource executes sql failed: %s. Datasource executes sql failed: %s.
400 Datasource.DuplicatedName.Error The name "%s" already exists, please replace it before saving. The name "%s" already exists, please replace it before saving.
400 Access.Forbidden Your instance version or access key is not allowed to call the API operation, only professional version supports calling. Your instance version or access key is not allowed to call the API operation, only professional version supports calling.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.