Updated on 2022-09-15 GMT+08:00

Importing a Connection

Function

This API is used to import one or more connection files from OBS to the Data Development module. Before using this API, store connection files in OBS buckets.

URI

  • URI format

    POST /v1/{project_id}/connections/import

  • Parameter description
    Table 1 URI parameter

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID. For details about how to obtain a project ID, see Project ID and Account ID.

Request

Request parameters

Parameter

Mandatory

Type

Description

path

Yes

String

With OBS deployed: OBS path for storing the connection definition file. For details about the format of the job definition file, see the response message of the exported connection.

Without OBS deployed: local path for storing the connection definition file.

params

No

List<Params>

Connection parameter. By default, this parameter is left blank.

sameNamePolicy

No

String

Policy for specifying how to handle duplicate names. The options are as follows:

  • SKIP
  • OVERWRITE

    Default value: SKIP

Params connection parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Name of a connection.

type

Yes

String

Connection type.

params

No

Map<String,Stri

ng>

Connection parameter. For details about parameter names, see the description of each type of connection configuration item. By default, this parameter is left blank.

Response

Parameter

Mandatory

Type

Description

taskId

Yes

String

ID of the task. Used to call the API for querying system tasks to obtain the import status.

Example

Import a connection.

  • Request
    POST /v1/b384b9e9ab9b4ee8994c8633aabc9505/connections/import
    {
        "path":"obs://00zyx/2019-07-02/DLF_All_DataConnections.zip",
        "sameNamePolicy":"OVERWRITE",
        "params":[
            {
                "name":"DWS",
                "type":"DWS",
                "params":{
                    "clusterName":"cluster1"
                }
            },
            {
                "name":"hive",
                "type":"HIVE",
                "params":{
                    "clusterName":"mrs_ymcc",
                    "connectionMethod":"agent",
                    "userName":"admin",
                    "agentName":"cdm-donotdelete",
                    "kmsKey":"KMS-42ab"
                }
            }
        ]
    }
  • Success response

    HTTP status code 200

    {
    	"taskId":"008aae2e675933c7016759418e870000"
    }
  • Failure response

    HTTP status code 400

    {
        "error_code":"DLF.0815",
        "error_msg":"Fail to read OBS file."
    }

Status Codes

See Status Codes.