Create connector¶
Save an external data source connector in the current workspace. Creating only saves connection information and does not start importing or exporting data.
POST https://moi.matrixorigin.cn/newmoi/connectors
Preparation before calling¶
First select the data source and purpose in Data Source Type Description, then use Validate connector configuration to check the current connection details. Prepare a personal access token and target workspace ID that can access the target workspace.
The example below uses:
$AI_STUDIO_API_KEY: The actual personal access token, passed through theX-API-KeyHeader.$WORKSPACE_ID: The workspace ID of the connector to be created, passed through theX-Workspace-IDHeader.$CONNECTOR_NAME: New connector name.$S3_ENDPOINT: Target standard S3 service address.$S3_ACCESS_KEY_ID: Access key ID for target standard S3.$S3_ACCESS_KEY_SECRET: Access key for target standard S3.$S3_BUCKET_NAME: The name of the bucket to access.$S3_REGION: The region where the target bucket is located.
config Nested by data source type. source_type of standard S3 is 5, and its connection configuration must be written in config.s3; do not place the configuration field directly under config.
Request example¶
curl -X POST "https://moi.matrixorigin.cn/newmoi/connectors" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d "{
\"name\": \"$CONNECTOR_NAME\",
\"source_type\": 5,
\"usage_type\": [1],
\"config\": {
\"s3\": {
\"endpoint\": \"$S3_ENDPOINT\",
\"access_key_id\": \"$S3_ACCESS_KEY_ID\",
\"access_key_secret\": \"$S3_ACCESS_KEY_SECRET\",
\"bucket_name\": \"$S3_BUCKET_NAME\",
\"region\": \"$S3_REGION\"
}
}
}"
Request body¶
When you create a connector, you also specify a name, data source type, purpose, and connection configuration for that type.
Field |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
Connector name. |
|
integer |
Yes |
Data source type code. See Data Source Type Description for available type and usage combinations. |
|
integer or integer[] |
Yes |
Connector purpose, bitmask. Values: |
|
object |
Yes |
Type-specific connection configuration. The top-level key must correspond to |
[] after a type denotes an array. [] in a field path denotes each item in an array.
Configuration type correspondence¶
The connector types in the current creation form are as follows. When creating, use the corresponding top-level key in config based on the selected source_type; do not mix configuration fields of different types.
|
Connector Type |
|
|---|---|---|
|
MatrixOne |
|
|
Alibaba Cloud OSS |
|
|
Standard S3 |
|
|
HDFS |
|
|
Hive |
|
|
MySQL |
|
|
SQL Server |
|
|
Oracle |
|
|
PostgreSQL |
|
|
MongoDB |
|
|
Langfuse |
|
Type-specific configuration fields¶
The following fields are located in the corresponding config top-level keys.
MatrixOne (source_type: 3)¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
MatrixOne service address. |
|
integer |
Yes |
MatrixOne service port. |
|
string |
Yes |
Login user name. |
|
string |
Yes |
Login password. |
|
string |
No |
Default database name. |
Alibaba Cloud OSS (source_type: 4)¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
OSS Endpoint. The console’s Region selection writes to this field. |
|
string |
Yes |
AccessKey ID. |
|
string |
Yes |
AccessKey Secret. |
|
string |
Yes |
Bucket name, or |
Standard S3 (source_type: 5)¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
No |
S3 service Endpoint. |
|
string |
Yes |
Access key ID. |
|
string |
Yes |
Access key. |
|
string |
Yes |
Bucket name, or |
|
string |
No |
The region where the bucket is located. |
|
string |
No |
Session token for temporary credentials. |
|
boolean |
No |
Use the path-style S3 request address when |
HDFS(source_type: 7)¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
NameNode address. Can be prefixed with |
|
integer |
Yes |
Authentication type: Simple for |
|
string |
Required for Simple authentication |
HDFS username for Simple authentication. |
|
string |
Yes |
Principal used to authenticate to HDFS with Kerberos. |
|
string |
Required if Kerberos |
Keytab file path; used when |
|
string (Base64) |
Condition required for Kerberos |
Keytab content; takes precedence over |
|
string |
Required for Kerberos |
|
|
string (Base64) |
Condition required for Kerberos |
|
|
string |
No |
Proxy user after Kerberos authentication. |
|
string |
No |
The base path for connector access. |
Hive(source_type: 8)¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string[] |
Yes |
HiveServer2 addresses, up to three, in the format of |
|
integer |
Yes |
Authentication type: LDAP for |
|
string |
Yes for LDAP authentication |
LDAP user name. |
|
string |
Required for LDAP |
LDAP password. |
|
string |
Required for Kerberos |
Client Kerberos principal. |
|
string |
Required for Kerberos |
HiveServer2 service principal. |
|
string (Base64) |
Required for Kerberos |
Keytab content. |
|
string (Base64) |
Required for Kerberos |
|
The current connector page only provides two Hive authentication methods, LDAP and Kerberos, and does not provide the NONE authentication option.
MySQL (source_type: 9) and SQL Server (source_type: 10)¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
MySQL database host address. |
|
string |
Yes |
SQL Server database host address. |
|
integer |
Yes |
MySQL database port. |
|
integer |
Yes |
SQL Server database port. |
|
string |
Yes |
MySQL login user name. |
|
string |
Yes |
SQL Server login user name. |
|
string |
Yes |
MySQL login password. |
|
string |
Yes |
SQL Server login password. |
|
string |
No |
MySQL default database name. |
|
string |
No |
SQL Server default database name. |
Oracle(source_type: 11)¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
Oracle host address. |
|
integer |
Yes |
Oracle port. |
|
string |
Yes |
Login user name. |
|
string |
Yes |
Login password. |
|
string |
Yes |
Oracle Service Name. |
PostgreSQL (source_type: 12)¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
PostgreSQL host address. |
|
integer |
Yes |
PostgreSQL port. |
|
string |
Yes |
Login user name. |
|
string |
Yes |
Login password. |
|
string |
Yes |
Database name. |
MongoDB (source_type: 13)¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
MongoDB host address. |
|
integer |
Yes |
MongoDB port. |
|
string |
Yes |
Authentication method: |
|
string |
Yes for |
Login user name. |
|
string |
Yes for |
Login password. |
|
string |
Required for |
Authentication database. |
|
string |
No |
Replica set name. |
|
string |
No |
Read preference. |
|
string |
No |
Read concern level. Optional |
Langfuse(source_type: 14)¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
Langfuse service address. |
|
string |
Yes |
Langfuse Public Key. |
|
string |
Yes |
Langfuse Secret Key. This value is only used for submission and verification and will not be returned in subsequent detailed responses. |
|
string |
No |
Pull mode. Optional |
When creating a Langfuse connector, provide fields within these boundaries:
Connector usage: The creation form does not offer a usage selector; submit import usage.
Service-managed fields:
secret_key_ref,database_name, andtarget_tableare maintained by the service and must not be passed.
The request below uses standard S3 as an example. Other types retain the same outer request structure and replace the source_type, config top-level keys and type-specific fields with the corresponding values in the above table.
Successful response¶
The connector is saved when code in the response is OK. Record data.id, which is required for subsequent import or export tasks. Successful creation does not mean that subsequent data transmission will be successful.
{
"code": "OK",
"msg": "OK",
"data": {
"id": "conn_01",
"name": "s3-orders-import",
"source_type": 5,
"created_at": 1735632000,
"updated_at": 1735632000,
"status": "active",
"username": "user_01",
"related_task_ids": [],
"usage_type": [1],
"config": {
"s3": {
"endpoint": "https://s3.example.com",
"bucket_name": "orders",
"region": "us-east-1"
}
}
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
string |
New connector ID. |
|
string |
Saved connector name. |
|
integer |
Saved data-source type code. |
|
integer |
Creation time as a Unix timestamp. |
|
integer |
Update time as a Unix timestamp. |
|
string |
Current connector status. When it is |
|
string |
Username in configuration. |
|
string[] |
Initial association task list. |
|
integer[] |
A list of saved uses, expanded from a bitmask by the server. Example: |
|
object |
A saved type-specific connection configuration. Sensitive fields may not be returned; failure to return a field does not mean that saved credentials have been cleared. |
In this document, [] after a type means an array. In field paths, [] means each item in an array.
Error response¶
HTTP 200 does not necessarily mean that the creation was successful. Always check for code in the response; only code: "OK" indicates that the connector was created.
{
"code": "ErrParamInvalid",
"msg": "invalid connector parameters",
"data": null
}
Common HTTP errors¶
HTTP status |
Error code |
Common cause |
Recommended action |
|---|---|---|---|
|
|
The request body is invalid or the name contains disallowed characters. |
Correct the JSON and connector name. |
|
|
The request uses a data-source type that is not currently enabled. |
Select a currently available data-source type. |
|
|
The service could not create the connector. |
Check |
|
|
The service is temporarily unable to complete creation. |
Retry later. |
Follow-up operations¶
Record data.id. First decide the next step from data.status: when the connector is available, use data.usage_type to go to Create import task or Create export task; when it has failed, first Get connector details or Update connector to correct the configuration. To verify the saved connector, use data.id with Get connector details.