Invokes a data service API created in Quick BI.
This API has been deprecated. We recommend migrating to quickbi-public(2022-01-01) - QueryData for enhanced functionality and continued support. While the deprecated API remains temporarily accessible, no further updates or bug fixes will be provided.
Operation description
Prerequisites
Create a data service API in Quick BI. For more information, see Data Service.
Usage Restrictions
-
The data service feature is available only to Professional edition users.
-
The timeout for data service API calls is 60s, and the QPS limit for a single API is 10 requests per second.
-
If row-level permissions are enabled on the dataset that the data service API references, the API call may be blocked by the row-level permission policy.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
quickbi-public:QueryDataService |
get |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ApiId |
string |
Yes |
The API ID in the data service. For more information, see Data Service. |
f4cc43bc3*** |
| Conditions |
string |
No |
Query conditions for the data service, specified as key-value pairs in a map-type string. The key is the request parameter name and the value is the request parameter value. Keys and values must appear in pairs. Note:
|
{ "area": ["华东", "华北"], "shopping_date": "2019Q1", } |
| ReturnFields |
string |
No |
A list of parameter names to return, specified as a List-type string. |
["area", "city", "price", "date"] |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| Success |
boolean |
Indicates whether the request was successful. Possible values:
|
true |
| RequestId |
string |
The request ID. |
78C1AA2D-9201-599E-A0BA-6FC462E57A95 |
| Result |
object |
The query result. |
|
| Headers |
array<object> |
Column headers. |
|
|
object |
|||
| Aggregator |
string |
Aggregation operator. Only present for measure fields, such as SUM, AVG, and MAX. |
SUM |
| Column |
string |
The field name, which corresponds to the physical table field name. |
具体的物理字段名 |
| DataType |
string |
The data type of the field, such as number, string, date, datetime, time, or geographic. |
string |
| Granularity |
string |
The granularity of the dimension field. Returned only when the requested field is a date or geographic dimension. Possible values:
|
yearRegion |
| Label |
string |
The field alias, used as the key in each map data row of the Values parameter. |
area |
| Type |
string |
The field type, which distinguishes dimension fields from measure fields. |
StandardDimension |
| Sql |
string |
The SQL statement of the query. |
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> |
The query results. |
|
|
object |
Rows and columns of the returned data. This parameter uses a List<Map> structure where each Map represents a row of data. The key in each Map corresponds to the Headers#Label field. |
[{"area":"华东","city":"三明市"},{"area":"华东","city":"上海市"}] |
Examples
Success response
JSON format
{
"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": "上海市"
}
]
]
}
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 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. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.