Skip to content

Query Metric View Results

API Description

Use this API to query and return the result set for a specified metric view.

API URL

GET Http://{semantic_host:semantic_port}/semantic/api/v1.1/analysisView/query?viewName=view_test

For how to obtain semantic_host:semantic_port, see Calling APIs.

Request Parameters

Common Request Parameters (HEADERS)

Parameter Type Required Description
tenant-id String Yes The tenant ID that identifies the tenant where the metric view belongs
auth-type String Yes Authentication type. Supported values: UID, TOKEN, ACCOUNT, and APIKEY
auth-value String Yes The authentication value that corresponds to auth-type

How to Obtain Common Parameters

To obtain tenant-id, select a metric application in the top navigation bar of Aloudata CAN, choose API Integration from the left-side menu, and copy it from the API Integration page. Set auth-value to the authentication value that corresponds to the selected auth-type.

Request Parameters

Parameter Type Required Description
viewName String Yes Metric view name
pageIndex Integer No Current page. Defaults to 0.
pageSize Integer No Number of records. Defaults to 1001.
queryResultType String No Result return type. DATA returns result data and metadata; META returns metadata only.

Response Parameters

Parameter Type Required Description
metas Object Yes Metadata. For details, see metas parameters.
analysisView Array Yes Result array
queryId String No Query ID
waring String No Warning information

metas Parameters

Parameter Type Required Description
name String Yes Field name
dataTypeName String Yes Field type name
schemaName String Yes Schema name
tableName String Yes Table name

Request Example

http://127.0.0.1/semantic/api/v1.1/analysisView/query?viewName=view_test

Response Example

{
    "data": {
        "queryId": "afc66f6274714b9480952762c648a8af",
        "warning": null,
        "table": {
            "columns": {
                "haha": [
                    {
                        "value": 512881,
                        "flag": null,
                        "count": 1
                    }
                ],
                "metric_time": [
                    {
                        "value": "2024-04-23",
                        "flag": null,
                        "count": 1
                    }
                ]
            }
        },
        "metas": [
            {
                "name": "metric_time",
                "dataType": null,
                "dataTypeName": "DATE",
                "displaySize": null,
                "schemaName": null,
                "scale": null,
                "precision": null,
                "tableName": null
            },
            {
                "name": "haha",
                "dataType": null,
                "dataTypeName": "BIGINT",
                "displaySize": null,
                "schemaName": null,
                "scale": null,
                "precision": null,
                "tableName": null
            }
        ]
    },
    "success": true,
    "code": null,
    "message": null,
    "traceId": "c7a7eb497e5f40d7a16a97b17a52a131.524.17138708081470003"
}