QueryData
Calls an API that is created in Data Service.
Operation description
Before you begin
You must first create a Data Service API by using the Data Service feature of Quick BI. For more information, see Data Service.
Limits
The Data Service feature is available only to Professional Edition users.
For Data Service API calls, the API timeout period is 60s, and the queries per second (QPS) limit for a single API is 10.
If row-level permissions are enabled for the dataset referenced by a Data Service API, API calls are also intercepted by the row-level access policy.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
quickbi-public:QueryData |
get |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ApiId |
string |
Yes |
The API ID in Data Service. For more information, see Data Service. |
f4cc43bc3*** |
| UserId |
string |
No |
The user ID in Quick BI. For information about how to obtain the user ID, see QueryUserInfoByAccount. Note
This parameter specifies the identity of the user who uses Data Service. You can use it in combination with the row-level and column-level permission configurations of the dataset. Important If this parameter is not specified, an empty string is passed, or null is passed, the user ID of the owner of the current Quick BI organization is used by default. |
b5d8fd9348cc4327****afb604 |
| Conditions |
string |
No |
The query conditions for Data Service. Pass the conditions 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": ["test", "test"], "shopping_date": "2019Q1", } |
| ReturnFields |
string |
No |
The list of names of the returned parameters. The value is a list-type string. |
["area", "city", "price", "date"] |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| Success |
boolean |
Indicates whether the request is successful. Valid values:
|
true |
| RequestId |
string |
The request ID. |
a4d1a221d-41za1-**** |
| Result |
object |
The execution result of the API. Valid values:
|
{} |
| Headers |
array<object> |
The column headers. |
|
|
object |
The column headers. |
||
| Aggregator |
string |
The aggregation operator. This field is available only for measure fields, such as SUM, AVG, and MAX. Valid values:
|
SUM |
| Column |
string |
The field name, which corresponds to the field name in the physical table. |
test |
| DataType |
string |
The data type of the field. Valid values:
|
string |
| Granularity |
string |
The granularity of the dimension field. This field is returned only when the requested field is a date dimension or geographic dimension field. Valid values:
|
REGION |
| Label |
string |
The alias of the field. It is used as the key of the map data row in the Values parameter. |
area |
| Type |
string |
The field type, which is used to distinguish whether the field is a dimension or a measure. Valid values:
|
Dimension |
| OriginalColumn |
string |
The original name of the corresponding field in the dataset. |
area |
| Sql |
string |
The SQL statement of the query. Note
In addition to the parameter conditions passed in the current API, the filter conditions in the returned SQL statement also include the row-level and column-level permission configurations. |
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 '%test%' 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 returned query results. |
[{"area":"test","city":"test"},{"area":"test","city":"test"}] |
|
object |
The rows and columns of the returned data. This parameter uses a List |
{"area":"test","city":"test"} |
|
| ValuesV2 |
array<object> |
The returned query results, including the original value fields. |
|
|
array<object> |
Each row of data. |
||
| RowValue |
array<object> |
The row values. |
|
|
object |
The row values. |
||
| L |
string |
The field alias set in Data Service. |
test |
| V |
string |
The displayed value. |
0 |
| R |
string |
The original value. |
0 |
Examples
Success response
JSON format
{
"Success": true,
"RequestId": "a4d1a221d-41za1-****",
"Result": {
"Headers": [
{
"Aggregator": "SUM",
"Column": "test",
"DataType": "string",
"Granularity": "REGION",
"Label": "area",
"Type": "Dimension",
"OriginalColumn": "area"
}
],
"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 '%test%' GROUP BY COMPANY_T_1_.`area`, COMPANY_T_1_.`city` HAVING SUM(COMPANY_T_1_.`order_amt`) > 1 LIMIT 0, 10",
"Values": [
{
"area": "test",
"city": "test"
}
],
"ValuesV2": [
{
"RowValue": [
{
"L": "test",
"V": "0",
"R": "0"
}
]
}
]
}
}
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. | You are not authorized to call the data service API operation. |
| 400 | API.Not.Exist | The data service API operation does not exist. | The data service API operation does not exist. |
| 400 | Cube.Not.Exist | The Cube does not exist. | The Cube does not exist. |
| 400 | Invalid.Parameter.Conditions | The specified Conditions is invalid. %s is not defined. | The specified Conditions is invalid. %s is not defined. |
| 400 | Invalid.Parameter.ReturnFields | The specified returnFields is invalid. %s is not defined. | The specified returnFields is invalid. %s is not defined. |
| 400 | Missing.Conditions | The specified Conditions is invalid. You must specify %s. | The specified Conditions is invalid. You must specify %s. |
| 400 | Missing.Dimension.Measure | The dimension or measure %s does not exist in Cube. | 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. | Request forbidden by row level permission, dataset is %s, %s %s. |
| 400 | Datasource.Sql.ExecuteFailed | Failed to execute the SQL statement in the data source. | Failed to execute the SQL statement on the data source. |
| 400 | DataService.InputParam.Error | input parameter error: %s. | The parameters entered were incorrect: %s. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.