Skip to content

Update Metric

API Description

Use this API to update a metric in the metric platform.

API URL

POST Http://{anymetrics_host:anymetrics_port}/anymetrics/api/v1/metrics/update

For how to obtain anymetrics_host:anymetrics_port, see Calling APIs.

Request Parameters

Common Request Parameters (HEADERS)

Parameter Type Required Description
tenant-id String Yes The tenant ID for the tenant that contains the metric query content.
auth-type String Yes Authentication method. Supported values: UID, TOKEN, ACCOUNT, APIKEY.
auth-value String Yes Authentication value that corresponds to auth-type.
queryBy String No Set to UUID to update a metric by its metric code.

How to Obtain Common Parameters

To obtain tenant-id, select the metric application from the top navigation bar in Aloudata CAN, choose API Integration from the left navigation menu, and copy it from the API Integration page. Set auth-value based on the selected auth-type.

Request Parameters

Parameter Type Maximum Length Required Description
code String No Required when queryBy=UUID.
metricName String 128 Yes Unique metric identifier. This value cannot be modified. Only English letters, underscores, numbers, and spaces are supported.
metricDisplayName String 128 No Metric display name. Any character is supported.
businessCaliber String 300 No Business definition.
type String Yes Metric type. Enum values: ATOMIC for atomic metrics, DERIVED for derived metrics, and COMPOSITE for composite metrics.
owner String Yes User ID of the metric owner.
businessOwner String Yes User ID of the business owner.
caliber String Yes Metric calculation definition. See the tables below for the calculation definition of each metric type.
unit String No Metric unit.
metricCategoryId String No Category ID. The "Uncategorized" category is built in, and its categoryId is "-1". If omitted, the default is "Uncategorized".
basicAttributes Map No Basic attributes.
businessAttributes Map No Business attributes.
technicalAttributes Map No Technical attributes.
managementAttributes Map No Management attributes.

Response Parameters

Response Parameter Description

Parameter Type Required Maximum Length Description
code String Yes 32 API response code.
message String Yes 512 Message body.
traceId String Yes 128 Trace ID.
data array Yes Result. For details, see "data Parameter Description".

data Parameter Description

Parameter Type Required Maximum Length Description
result Boolean Yes Whether the update succeeded.

Request Example

{
    "type": "ATOMIC",
    "metricDisplayName": "Order Count_Custom Aggregate Function 5",
    "metricName": "ordercount_3",
    "owner": "correctness_test_qq",
    "businessOwner": "correctness_test_qq",
    "businessCaliber": "This is the updated version.",
    "metricCategoryId": "-1",
    "unit": "OTHER",
    "caliber": {
        "datasetName": "can_order",
        "expr": "count(['can_order'/'order_id'])",
        "metricTime": "order_date",
        "filters": [
            {
                "type": "EXPR",
                "expr": "IN(['can_product'/'brand_name'],\"Huawei\")"
            }
        ]
    },
    "basicAttributes": {
        "a": "1"
    },
    "businessAttributes": {
        "b": "2"
    },
    "technicalAttributes": {
        "c": "3"
    },
    "managementAttributes": {
        "d": "4"
    }
}

Response Example

{
    "data": true,
    "success": true,
    "code": "200",
    "errorMsg": null,
    "detailErrorMsg": null,
    "traceId": "f6e656798ed241c789f7132823c46c6b.141.17194028392300357"
}