Create a Dimension
API Description
Use this API to create a dimension in Aloudata CAN.
API URL
POST http://{anymetrics_host:anymetrics_port}/anymetrics/api/v1/dimension/createV2
To obtain anymetrics_host:anymetrics_port, see Calling APIs.
Request Parameters
Common Request Headers
| Parameter | Type | Required | Description |
|---|---|---|---|
| tenant-id | String | Yes | The tenant ID of the tenant that contains the metric query assets. |
| auth-type | String | Yes | Authentication type. Supported values: UID, TOKEN, ACCOUNT, APIKEY. |
| auth-value | String | Yes | Authentication value corresponding to auth-type. |
How to Obtain Common Parameters
In Aloudata CAN, select the metric application from the top navigation bar, then choose API Integration from the left navigation menu. You can obtain tenant-id on the API Integration page. Set auth-value to the authentication value required by the selected auth-type.

Request Body
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| dimName | String | Yes | Dimension name. - Unique within the tenant and cannot be modified. - Supports only letters, digits, and underscores. Two consecutive underscores are not supported. |
| datasetName | String | No | Dataset name. |
| dimDisplayName | String | Yes | Dimension display name. Supports any characters, up to 150 characters. |
| dimCategoryId | String | No | Dimension category ID. Use the fixed value -1 for Uncategorized. If omitted, the dimension is Uncategorized by default. |
| dimDescription | String | No | Dimension description. Supports any characters, up to 300 characters. |
| config | array | Yes | Dimension source, either a column or an expression. See config Parameters. |
| valueList | array | No | Dimension value list. See valuelist Parameters. |
| isPublish | String | No | Dimension status:true: publishedfalse: draft |
| basicAttributes | Map |
No | Basic attributes. |
| businessAttributes | Map |
No | Business attributes. |
| technicalAttributes | Map |
No | Technical attributes. |
| managementAttributes | Map |
No | Management attributes. |
config Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| type | String | Yes | Dimension type, which indicates the source type. Enumerated values: - COLUMN_BIND: column binding- CUSTOM: custom type |
| value | String | For a column-bound dimension, set value to the column name.For a custom dimension, set value to an expression. The expression is equivalent to adding a calculated column to the dataset. |
valuelist Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| value | String | No | Original dimension value. Cannot be an empty string or null. |
| name | String | No | Mapped name. Cannot be an empty string or null. |
| description | String | No | Description of the dimension value. |
Response Parameters
| Parameter | Type | Required | Description | |
|---|---|---|---|---|
| code | String | Yes | API response code. | |
| success | boolean | Yes | Whether the request succeeded. | |
| errorMsg | String | Yes | Error message. | |
| detailErrorMsg | String | Yes | Detailed error message. | |
| traceId | String | Yes | Trace ID for troubleshooting. | |
| data | Boolean | Yes | Dimension code. |
Request Example
{
"dimName": "tb_click_1",
"dimDisplayName": "tb_click_1",
"dimCategoryId": "-1",
"dimDescription": "weidu",
"datasetName": "tb_click",
"config": {
"type": "COLUMN_BIND",
"value": "user_id"
},
"valueList": [
{
"value": "Dimension value 01",
"name": "Dimension value 01",
"description": "Dimension value 01"
},
{
"value": "Dimension value 02",
"name": "Dimension value 02",
"description": "Dimension value 02"
}
]
}