對資料服務中已建立的API進行調用。
介面說明
前提條件
您需先通過 Quick BI 的資料服務,建立資料服務的 API,具體請參見:資料服務。
使用限制
資料服務功能僅針對專業版客戶開放。
資料服務 API 呼叫,介面逾時時間為 60s,單個 API 的 QPS 為 10 次/秒。
資料服務 API 所引用資料集,如果開啟了行級許可權,API 呼叫的時候也會被行級權限原則攔截。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
|
操作 |
存取層級 |
資源類型 |
條件關鍵字 |
關聯操作 |
|
quickbi-public:QueryData |
get |
*全部資源
|
無 | 無 |
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| ApiId |
string |
是 |
資料服務中的 API ID,請參見:資料服務。 |
f4cc43bc3*** |
| UserId |
string |
否 |
Quick BI 中的 userId。如何擷取 userId,請參見:根據帳號查詢使用者資訊介面 說明
該參數用於指定具體使用資料服務的人的身份,可結合資料集的行列許可權配置使用 重要 參數不傳、傳Null 字元串、傳 null 等情況,預設傳入的 userId 為當前 Quick BI 組織的 owner |
b5d8fd9348cc4327****afb604 |
| Conditions |
string |
否 |
資料服務的查詢條件,以 Key 和 Value 的形式傳入。map 類型的字串。其中,Key 為請求參數的參數名,Value 為請求參數的參數值。Key 和 Value 必須成對出現。 說明:
|
{ "area": ["test", "test"], "shopping_date": "2019Q1", } |
| ReturnFields |
string |
否 |
返回參數的參數名列表,List 類型字串。 |
["area", "city", "price", "date"] |
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
|||
| Success |
boolean |
是否請求成功。取值範圍:
|
true |
| RequestId |
string |
請求 ID。 |
a4d1a221d-41za1-**** |
| Result |
object |
返回介面執行結果。取值範圍:
|
|
| Headers |
array<object> |
列頭。 |
|
|
object |
|||
| Aggregator |
string |
彙總操作符。度量欄位才會有,例如 SUM、AVG 和 MAX。
|
SUM |
| Column |
string |
欄位名,對應物理表欄位名。 |
test |
| DataType |
string |
欄位的資料類型。一般有:
|
string |
| Granularity |
string |
維度欄位的粒度。 當請求欄位為日期維度或地理維度欄位,才會返回該欄位,取值範圍:
|
REGION |
| Label |
string |
欄位別名,結果參數 values 中 map 資料行的 key。 |
area |
| Type |
string |
欄位類型,用於區分是欄位類型為維度或度量欄位。
|
Dimension |
| OriginalColumn |
string |
資料集裡對應的欄位原名。 |
area |
| Sql |
string |
請求查詢的 SQL。 說明
返回的 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 |
array<object> |
返回查詢到的結果。 |
|
|
object |
返回資料的行和列。 此參數為 List |
[{"area":"test","city":"test"},{"area":"test","city":"test"}] |
樣本
正常返回樣本
JSON格式
{
"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"
}
]
]
}
}
錯誤碼
|
HTTP status code |
錯誤碼 |
錯誤資訊 |
描述 |
|---|---|---|---|
| 400 | API.No.Permission | You are not authorized to call the data service API operation. | 您無權調用此資料服務API。 |
| 400 | API.Not.Exist | The data service API operation does not exist. | 資料服務 API 不存在。 |
| 400 | Cube.Not.Exist | The Cube does not exist. | 資料集不存在。 |
| 400 | Invalid.Parameter.Conditions | The specified Conditions is invalid. %s is not defined. | 參數 Conditions 錯誤:%s 未在模型中定義。 |
| 400 | Invalid.Parameter.ReturnFields | The specified returnFields is invalid. %s is not defined. | 參數ReturnFields錯誤:%s 未在模型中定義。 |
| 400 | Missing.Conditions | The specified Conditions is invalid. You must specify %s. | 輸入參數Conditions 錯誤: %s 是必須項。 |
| 400 | Missing.Dimension.Measure | The dimension or measure %s does not exist in Cube. | Cube 模型中缺少維度或度量 %s 。 |
| 400 | Rowlevel.Permission.Forbbiden | The request is denied by row level permission. The dataset is %s, %s %s. | 請求被行級許可權限制,資料集為%s,%s %s。 |
| 400 | Datasource.Sql.ExecuteFailed | Failed to execute the SQL statement in the data source. | 資料來源執行SQL失敗。 |
| 400 | DataService.InputParam.Error | input parameter error: %s. | 輸入的參數有誤: %s。 |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。