Memanggil API Studio Layanan Data untuk mengkueri data.
Deskripsi operasi
Prerequisites
Create an API in DataService Studio before calling this operation.
Limits
-
Requires Quick BI Professional Edition.
-
API call timeout: 60s. QPS limit per API: 10.
-
Row-level permissions on the referenced dataset also apply to API calls.
Coba sekarang
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
quickbi-public:QueryData |
get |
*全部资源
|
None | None |
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| ApiId |
string |
Yes |
ID API di Studio Layanan Data. |
f4cc43bc3*** |
| UserId |
string |
No |
ID pengguna Quick BI. Dapatkan nilai ini dari QueryUserInfoByAccount. Catatan
Menentukan identitas pengguna untuk Studio Layanan Data, digunakan bersama konfigurasi izin tingkat baris dan kolom. Penting
Jika dihilangkan, kosong, atau null, nilai default adalah ID pengguna pemilik organisasi Quick BI. . |
b5d8fd9348cc4327****afb604 |
| Conditions |
string |
No |
Kondisi filter sebagai string peta JSON. Setiap kunci adalah nama parameter permintaan, dan setiap nilai adalah nilai parameter. Catatan:
|
{ "area": ["test", "test"], "shopping_date": "2019Q1", } |
| ReturnFields |
string |
No |
Array JSON nama bidang yang akan dikembalikan. |
["area", "city", "price", "date"] |
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
|||
| Success |
boolean |
Whether the request succeeded. Valid values:
|
true |
| RequestId |
string |
The request ID. |
a4d1a221d-41za1-**** |
| Result |
object |
The result of the API call. Valid values:
|
|
| Headers |
array<object> |
The column headers. |
|
|
object |
Column headers. |
||
| Aggregator |
string |
The aggregate operator. This parameter is returned only for measure fields, such as SUM, AVG, and MAX.
|
SUM |
| Column |
string |
The field name. It corresponds to the field name in the physical table. |
test |
| DataType |
string |
The data type of the field. Common types include the following:
|
string |
| Granularity |
string |
The granularity of the dimension field. This parameter is returned only when the requested field is a date dimension or a geographic dimension. Valid values:
|
REGION |
| Label |
string |
The alias of the field. It is the key for the map data row in the values result parameter. |
area |
| Type |
string |
The field type. It indicates whether the field is a dimension or a measure.
|
Dimension |
| OriginalColumn |
string |
The original name of the corresponding field in the dataset. |
area |
| Sql |
string |
The SQL statement for the query. Catatan
The returned SQL includes both the filter conditions from this call and any row-level or column-level permission rules. |
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 query results. |
|
|
object |
The returned data rows. Each map represents one row, with keys corresponding to the |
[{"area":"test","city":"test"},{"area":"test","city":"test"}] |
Contoh
Respons sukses
JSONformat
{
"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"
},
{
"area": "test",
"city": "test"
}
]
]
}
}
Kode kesalahan
|
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. | |
| 400 | DataService.InputParam.Error | input parameter error: %s. |
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.