Register a Data Source
API Overview
Use this API to add an external data source to the semantic layer. The data source can then be used to create metrics and perform data analysis.
API URL
POST Http://{anymetrics_host:anymetrics_port}/anymetrics/api/v1/datasource/create
For how to obtain anymetrics_host:anymetrics_port, see Calling APIs.
| Parameter |
Type |
Required |
Description |
| tenant-id |
String |
Yes |
Tenant ID. Identifies the tenant that owns the resource. |
| user-id |
String |
Yes |
User ID. Identifies the user performing this operation. |
Request Parameters
| Parameter |
Type |
Required |
Description |
Example |
| name |
String |
Yes |
Data source name. |
datasource |
| displayName |
String |
No |
Data source display name. |
Sample data source |
| desc |
String |
No |
Data source description. |
This is the first data source created. |
| datasourceType |
String |
Yes |
Data source type, such as Aloudata AIR, Starrocks, or doris. |
Starrocks |
| configuration |
Array |
Yes |
Connection property configuration. For details, see 3.1.1 configuration. |
|
configuration
| Parameter |
Type |
Required |
Description |
Example |
| host |
String |
Yes |
Connection IP address. |
10.5.23.25 |
| port |
Integer |
Yes |
Port number. |
31010 |
| loadbalance |
String |
No |
Load balancing cluster. |
10.5.23.25:9030,10.5.23.21:9030 |
| user |
String |
Yes |
Username. |
root |
| password |
String |
Yes |
Password. |
root |
| engineType |
String |
Yes |
Engine type. |
For example, AIR |
| properties:{ "AIR_ENGINE_TENANT_ID":"", "AIR_ENGINE_CLOUD_ACCOUNT":"" } |
JSON |
No |
Connection properties. |
{ "AIR_ENGINE_TENANT_ID":"tardis_0530", "AIR_ENGINE_CLOUD_ACCOUNT":"2f44uk6iv0u8@aloudata.com" } |
Response Parameters
| Parameter |
Type |
Required |
Description |
Example |
| success |
Boolean |
Yes |
Whether the response succeeded. |
true |
| code |
String |
Yes |
API response code. |
200 |
| errorMsg |
String |
Yes |
Error message. |
Request successful |
| detailErrorMsg |
String |
Yes |
Detailed error message. |
|
| traceId |
String |
Yes |
Trace ID for troubleshooting. |
fdde6861bd554805998343f9ff2dcd70.292.16857691758642861 |
| data |
Array |
Yes |
Returned result data. For details, see 4.1 data. |
|
data
| Parameter |
Type |
Required |
Description |
Example |
| datasourceId |
String |
Yes |
Data source ID. |
ds_123149 |
| catalog |
String |
Yes |
Catalog name. |
tn_123100_eb5899b802db890f69cea427bca13ae2 |
Request Example
{
"name": "dataSource",
"displayName": "Metrics platform data source",
"desc": "This is an example metrics platform data source.",
"datasourceType": "STARROCKS",
"configuration": {
"host": "0.0.0.0",
"port": "9030",
"user": "root",
"password": "xxxxxxxx",
"engineType": "STARROCKS"
}
}
Response Example
{
"data": {
"datasourceId": "ds_20110954",
"catalog": "tn_20110941_datasource"
},
"success": true,
"code": "200",
"errorMsg": null,
"detailErrorMsg": null,
"traceId": "6387c419bf5d48d9a00613bd98057244.148.17289018554670115"
}