Calls an API created in Data Service.
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
Before you begin
You have created an API in the Data Service of Quick BI. For more information, see Data Service.
Limits
The Data Service feature is available only to Professional Edition users.
When you invoke a Data Service API, the timeout period is 60 seconds, 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, the request may be blocked by the row-level access policy when you invoke the API.
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 ID of the API in Data Service. For more information, see Data Service. |
f4cc43bc3*** |
| Conditions |
string |
No |
The query conditions for Data Service, passed in key-value pairs. The value is a string of the map type. The key is the name of the request parameter, and the value is the value of the request parameter. Keys and values must appear in pairs. Note:
|
{ "area": ["East China", "North China"], "shopping_date": "2019Q1", } |
| ReturnFields |
string |
No |
The list of return parameter names. The value is a string of the list type. |
["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 ID of the request. |
78C1AA2D-9201-599E-A0BA-6FC462E57A95 |
| Result |
object |
The query result returned by the API. |
|
| Headers |
array<object> |
The column headers. |
|
|
object |
|||
| Aggregator |
string |
The aggregation operator. This field is available only for measure fields, such as SUM, AVG, and MAX. |
SUM |
| Column |
string |
The field name, which corresponds to the physical table field name. |
Specific physical field name |
| DataType |
string |
The data type of the field. Common values include number, string, date, datetime, time, and geographic. |
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:
|
yearRegion |
| Label |
string |
The alias of the field, which is the key of the map data row in the Values result parameter. |
area |
| Type |
string |
The field type, which is used to distinguish whether the field is a dimension or a measure. |
StandardDimension |
| Sql |
string |
The SQL statement of the query request. |
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 '%East China%' 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. |
|
|
object |
The rows and columns of the returned data. This parameter is of the List |
[{"area":"East China","city":"Sanming"},{"area":"East China","city":"Shanghai"}] |
Examples
Success response
JSON format
{
"Success": true,
"RequestId": "78C1AA2D-9201-599E-A0BA-6FC462E57A95",
"Result": {
"Headers": [
{
"Aggregator": "SUM",
"Column": "The alias of the field. The key of the map data row in the result parameter values.",
"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_ LIMIT 0, 10",
"Values": [
[
{
"area": "west",
"city": "asd"
},
{
"area": "wesd",
"city": "sdfa"
}
]
]
}
}
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 SQL on the data source. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.