Skip to content

通用数据查询接口

衡石系统提供了通用的数据查询接口,返回结果是数据集数据 datasetResultDto

用 HE 表达式查询数据

请求URL

http
POST /api/data/query HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

URL 参数
字段类型说明
limitNUMBER可选,返回记录的最大条数,默认是1000
offsetNUMBER可选,返回第几页数据,默认是0
Request Body 参数

HE 表达式,详情参照HE 的数据集函数

返回对象的格式说明

数据集数据 datasetResultDto

参考示例

http
POST /api/data/query?limit=1 HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
	"kind":"formula",
	"op":"summarize(app_dataset(1, 1), {type}, sum({votes}) as 'sum1')"
}
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
    "version": "version@9a5e106#6730f0d",
    "code": 0,
    "msg": "success",
    "data": {
        "data": [
            [
                "喜剧",
                16.5,
                8.3
            ]
        ],
        "schema": [
            {
                "fieldName": "type",
                "visible": true,
                "nativeType": "text"
            },
            {
                "fieldName": "sum1",
                "visible": true,
                "nativeType": "numeric"
            },
            {
                "fieldName": "max1",
                "visible": true,
                "nativeType": "numeric"
            }
        ]
    }
}

HENGSHI SENSE API 使用手册