对数据服务中已创建的API进行调用。
目前该API接口已标记为弃用,推荐使用替代API:quickbi-public(2022-01-01) - QueryData。
接口说明
前提条件
您通过 Quick BI 的数据服务,创建数据服务的 API,具体请参见数据服务。
使用限制
数据服务功能仅针对专业版客户开放。
数据服务 API 调用,接口超时时间为 60s,单个 API 的 QPS 为 10 次/秒。
数据服务 API 所引用数据集,如果开启了行级权限,API 调用的时候可能会被行级权限策略拦截。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
quickbi-public:QueryDataService |
get |
*全部资源
|
无 | 无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| ApiId |
string |
是 |
数据服务中的 API ID,请参见:数据服务。 |
f4cc43bc3*** |
| Conditions |
string |
否 |
数据服务的查询条件,以 Key 和 Value 的形式传入。map 类型的字符串。其中,Key 为请求参数的参数名,Value 为请求参数的参数值。Key 和 Value 必须成对出现。 说明:
|
{ "area": ["华东", "华北"], "shopping_date": "2019Q1", } |
| ReturnFields |
string |
否 |
返回参数的参数名列表,List 类型字符串。 |
["area", "city", "price", "date"] |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
|||
| Success |
boolean |
是否请求成功。取值范围:
|
true |
| RequestId |
string |
请求 ID。 |
78C1AA2D-9201-599E-A0BA-6FC462E57A95 |
| Result |
object |
返回接口查询结果。 |
|
| Headers |
array<object> |
列头。 |
|
|
object |
|||
| Aggregator |
string |
聚合操作符。度量字段才会有,例如 SUM、AVG 和 MAX。 |
SUM |
| Column |
string |
字段名,对应物理表字段名。 |
具体的物理字段名 |
| DataType |
string |
字段的数据类型。一般有 number、string、date、datetime、time、geographic。 |
string |
| Granularity |
string |
维度字段的粒度。 当请求字段为日期维度或地理维度字段,才会返回该字段,取值范围:
|
yearRegion |
| Label |
string |
字段别名,结果参数 values 中 map 数据行的 key。 |
area |
| Type |
string |
字段类型,用于区分是字段类型为维度或度量字段。 |
StandardDimension |
| Sql |
string |
请求查询的 SQL。 |
SELECT COMPANY_T_1_.`area` AS D_AREA_2_, COMPANY_T_1_.`city` AS D_CITY_3_, SUM(COMPANY_T_1_.`profit_amt`) AS D_PROFIT_4_ FROM `quickbi_test`.`company_sales_record_copy` AS COMPANY_T_1_ WHERE COMPANY_T_1_.`area` LIKE '%华东%' GROUP BY COMPANY_T_1_.`area`, COMPANY_T_1_.`city` HAVING SUM(COMPANY_T_1_.`order_amt`) > 1 LIMIT 0, 10 |
| Values |
array<object> |
返回查询到的结果。 |
|
|
object |
返回数据的行和列。 此参数为 List |
[{"area":"华东","city":"三明市"},{"area":"华东","city":"上海市"}] |
示例
正常返回示例
JSON格式
{
"Success": true,
"RequestId": "78C1AA2D-9201-599E-A0BA-6FC462E57A95",
"Result": {
"Headers": [
{
"Aggregator": "SUM",
"Column": "具体的物理字段名",
"DataType": "string",
"Granularity": "yearRegion",
"Label": "area",
"Type": "StandardDimension"
}
],
"Sql": "SELECT COMPANY_T_1_.`area` AS D_AREA_2_, COMPANY_T_1_.`city` AS D_CITY_3_, SUM(COMPANY_T_1_.`profit_amt`) AS D_PROFIT_4_ FROM `quickbi_test`.`company_sales_record_copy` AS COMPANY_T_1_ WHERE COMPANY_T_1_.`area` LIKE '%华东%' GROUP BY COMPANY_T_1_.`area`, COMPANY_T_1_.`city` HAVING SUM(COMPANY_T_1_.`order_amt`) > 1 LIMIT 0, 10",
"Values": [
[
{
"area": "华东",
"city": "三明市"
},
{
"area": "华东",
"city": "上海市"
}
]
]
}
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | API.No.Permission | You are not authorized to call the data service API operation. | |
| 400 | API.Not.Exist | The data service API operation does not exist. | |
| 400 | Cube.Not.Exist | The Cube does not exist. | |
| 400 | Invalid.Parameter.Conditions | The specified Conditions is invalid. %s is not defined. | |
| 400 | Invalid.Parameter.ReturnFields | The specified returnFields is invalid. %s is not defined. | |
| 400 | Missing.Conditions | The specified Conditions is invalid. You must specify %s. | |
| 400 | Missing.Dimension.Measure | The dimension or measure %s does not exist in Cube. | |
| 400 | Rowlevel.Permission.Forbbiden | The request is denied by row level permission. The dataset is %s, %s %s. | |
| 400 | Datasource.Sql.ExecuteFailed | Failed to execute the SQL statement in the data source. |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。