工作表记录
获取行记录透视数据
获取工作表记录透视表汇总数据,适用于数据分析统计场景,与统计中透视表功能一致
鉴权方式
AppKey + Sign 是应用密钥鉴权,由管理员创建,用于以应用管理员身份访问应用数据。
版本
请求地址
Path 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
worksheet_id | string | 是 | 工作表ID |
Header 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
HAP-Appkey | string | 是 | HAP应用密钥 |
HAP-Sign | string | 是 | HAP签名 |
Body 参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
pageSize | integer | 否 | 每页数量,最大为1000 |
pageIndex | integer | 否 | 页码 |
viewId | string | 否 | 视图ID |
columns | object[] | 否 | 列(维度)字段列表 |
columns.field | string | 是 | 字段ID |
columns.displayName | string | 否 | 显示名称 |
columns.granularity | integer | 否 | 日期、地区统计维度
|
columns.includeEmpty | boolean | 否 | 是否统计空值,默认为false不统计 |
rows | object[] | 否 | 行(维度)字段列表 |
rows.field | string | 是 | 字段ID |
rows.displayName | string | 否 | 显示名称 |
rows.granularity | integer | 否 | 日期、地区统计维度
|
rows.includeEmpty | boolean | 否 | 是否统计空值,默认为false不统计 |
values | object[] | 是 | 值字段列表 |
values.field | string | 是 | 字段ID,仅统计记录行数时,使用record_count作为字段ID |
values.displayName | string | 否 | 显示名称 |
values.aggregation | string | 是 | 聚合方式(不区分大小写)
可选值: "COUNT""DISTINCTCOUNT""SUM""MIN""MAX""AVG" |
values.includeEmpty | boolean | 否 | 是否统计空值,默认为false不统计,空值将显示为0 |
filter | object | 否 | 筛选器 |
filter.type | string | 是 | 筛选类型,当type为condition时,field/operator/value为必填;当type为group时,logic为必填 可选值: "group""condition" |
filter.logic | string | 否 | 逻辑操作符,不区分大小写 可选值: "AND""OR" |
filter.field | string | 否 | 字段ID或别名(当type为condition时必填) |
filter.operator | string | 否 | 运算符(当type为condition时必填) |
filter.value | any | 否 | 条件值(当type为condition时必填) |
filter.children | object[] | 否 | 子筛选条件(当type为group时使用) |
filter.children.type | string | 是 | 筛选类型,当type为condition时,field/operator/value为必填;当type为group时,logic为必填 可选值: "group""condition" |
filter.children.logic | string | 否 | 逻辑操作符,不区分大小写 可选值: "AND""OR" |
filter.children.field | string | 否 | 字段ID或别名(当type为condition时必填) |
filter.children.operator | string | 否 | 运算符(当type为condition时必填) |
filter.children.value | any | 否 | 条件值(当type为condition时必填) |
filter.children.children | object | 否 | 筛选器配置 |
filter.children.children.type | string | 是 | 筛选类型,当type为condition时,field/operator/value为必填;当type为group时,logic为必填 可选值: "group""condition" |
filter.children.children.logic | string | 否 | 逻辑操作符,不区分大小写 可选值: "AND""OR" |
filter.children.children.field | string | 否 | 字段ID或别名(当type为condition时必填) |
filter.children.children.operator | string | 否 | 运算符(当type为condition时必填) |
filter.children.children.value | any | 否 | 条件值(当type为condition时必填) |
filter.children.children.children | object[] | 否 | 子筛选条件(当type为group时使用) |
filter.children.children.children.type | string | 是 | 筛选类型,当type为condition时,field/operator/value为必填;当type为group时,logic为必填 可选值: "group""condition" |
filter.children.children.children.logic | string | 否 | 逻辑操作符,不区分大小写 可选值: "AND""OR" |
filter.children.children.children.field | string | 否 | 字段ID或别名(当type为condition时必填) |
filter.children.children.children.operator | string | 否 | 运算符(当type为condition时必填) |
filter.children.children.children.value | any | 否 | 条件值(当type为condition时必填) |
filter.children.children.children.children | object | 否 | 筛选器配置 |
sorts | object[] | 否 | 排序字段 |
sorts.field | string | 是 | 字段ID |
sorts.isAsc | boolean | 是 | 是否升序,默认为降序 |
includeSummary | boolean | 否 | 返回值是否包含所有行汇总值 |
响应参数
200成功获取透视表数据| 名称 | 类型 | 描述 |
|---|---|---|
success | boolean | 是否调用成功 |
error_code | integer | 错误代码 |
error_msg | string | 错误消息 |
data | object | — |
data.meta | object | 透视表元数据 |
data.meta.columns | object[] | 列(维度)字段列表 |
data.meta.columns.field | string | 字段ID |
data.meta.columns.displayName | string | 显示名称 |
data.meta.columns.granularity | integer | 日期、地区统计维度
|
data.meta.columns.includeEmpty | boolean | 是否统计空值,默认为false不统计 |
data.meta.rows | object[] | 行(维度)字段列表 |
data.meta.rows.field | string | 字段ID |
data.meta.rows.displayName | string | 显示名称 |
data.meta.rows.granularity | integer | 日期、地区统计维度
|
data.meta.rows.includeEmpty | boolean | 是否统计空值,默认为false不统计 |
data.meta.values | object[] | 值字段列表 |
data.meta.values.field | string | 字段ID,仅统计记录行数时,使用record_count作为字段ID |
data.meta.values.displayName | string | 显示名称 |
data.meta.values.aggregation | string | 聚合方式(不区分大小写)
可选值: "COUNT""DISTINCTCOUNT""SUM""MIN""MAX""AVG" |
data.meta.values.includeEmpty | boolean | 是否统计空值,默认为false不统计,空值将显示为0 |
data.pivot | object[] | 透视表数据 |
data.pivot.columns | object | 列数据,字段ID对应的值 |
data.pivot.rows | object | 行数据,字段ID对应的值 |
data.pivot.values | object | 值数据,字段ID对应的计算值 |
data.summary | object | 汇总值,字段ID对应的汇总值 |
data.totalPages | integer | 总页数 |
data.currentPage | integer | 当前页码 |
curl -X POST "https://example.com/v3/app/worksheets/worksheet_id/rows/pivot" \ -H "HAP-Appkey: {{HAP-Appkey}}" \ -H "HAP-Sign: {{HAP-Sign}}" \ -H "Content-Type: application/json" \ -d '{ "values": [ { "field": "string", "aggregation": "COUNT" } ] }'{ "success": true, "error_code": 0, "error_msg": "string", "data": { "meta": { "columns": [ { "field": "string", "displayName": "string", "granularity": 0, "includeEmpty": false } ], "rows": [ { "field": "string", "displayName": "string", "granularity": 0, "includeEmpty": false } ], "values": [ { "field": "string", "displayName": "string", "aggregation": "COUNT", "includeEmpty": false } ] }, "pivot": [ { "columns": { "property1": "string", "property2": "string" }, "rows": { "property1": "string", "property2": "string" }, "values": { "property1": 0, "property2": 0 } } ], "summary": { "property1": 0, "property2": 0 }, "totalPages": 0, "currentPage": 0 }}