調用該介面擷取資料表資料下載任務的執行結果。
使用說明
- 單個下載任務的下載連結一天內只能擷取3次。
- 下載連結的有效期間為5分鐘。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
請求參數
| 名稱 | 類型 | 是否必選 | 樣本值 | 描述 |
| Action | String | 是 | GetDownloadFile | 系統規定參數。取值:GetDownloadFile。 |
| Context | Map | 否 | {"xxx";xxx} | 請求內容。 |
| IotInstanceId | String | 否 | iot-cn-npk1u****** | 執行個體ID。您可在物聯網平台控制台的執行個體概覽頁面,查看當前執行個體的ID。 重要
執行個體的更多資訊,請參見執行個體概述。 |
| LongJobId | String | 是 | 62d949808bc742187xxxxxx | 建立下載任務時返回的長任務ID,請參見CreateDownloadDataJob中的LongJobId參數。 |
調用API時,除了本文介紹的該API的特有請求參數,還需傳入公用請求參數。公用請求參數說明,請參見公用參數文檔。
返回資料
| 名稱 | 類型 | 樣本值 | 描述 |
| Code | String | 200 | 調用失敗時,返回的錯誤碼。更多資訊,請參見錯誤碼。 |
| ErrorMessage | String | no authorization. | 調用失敗時,返回的錯誤資訊。 |
| RequestId | String | BB71E443-4447-4024-A000-EDE09934**** | 請求ID,阿里雲為該請求產生的唯一識別碼。 |
| Success | Boolean | true | 是否調用成功。
|
| Data | Object | 資料。 |
|
| Status | Integer | 1 | 下載任務的執行狀態。
|
| LongJobId | String | 62d949808bc742187xxxxxx | 下載任務的ID。 |
| BeginTime | Long | 1658406464534 | 下載任務的開始時間。 |
| AsyncExecute | Boolean | true | 是否是非同步查詢。
|
| TotalCount | Long | 100 | 總數。 |
| EndTime | Long | 1658406465000 | 下載任務的結束時間。 |
| PreviewSize | Integer | 100 | 預覽大小。 |
| PageNo | Integer | 1 | 分頁頁碼。 |
| PageSize | Integer | 10 | 分頁大小。 |
| CsvUrl | String | https://xxxxx-data-download-sh.oss-cn-shanghai.aliyuncs.com/data/download/6B761BxxxxxxxxAAA0BF03D32C80E/62da39b9xxxxxx5a7b953376/download_file_name.csv?Expires=1658469132&OSSAccessKeyId=xxxxxxxxx&Signature=rRL%xxxxxxx%3D | OSS檔案的下載地址。(有效期間5分鐘) |
| CsvFileName | String | test_download_flie | CSV檔案名稱。 |
| DatasetId | String | xxxxxx | 下載對象ID。 |
| ResultDataInString | String | {"a":123} | 查詢執行結果。 |
| Header | Array of Header | 欄位資訊。 |
|
| TypeClass | String | date | 類型。 |
| FieldName | String | user_name | 欄位名。 |
| GeoClass | String | {xxx:xxxx} | 地理資訊。 |
| FieldType | String | INTEGER | 欄位資料類型。 |
| TimeClass | String | HOUR/DAY/MONTH | 時間維度。 |
| DimDateClass | String | DAY | 調度類型。 |
| Alias | String | user_name_alias | 欄位別名。 |
| Result | Array of Object | {"a":123} | |
| QuerySetting | Object | 查詢請求資訊。 |
|
| SelectedHeaders | Array of SelectedHeaders | 查詢欄位列表。 |
|
| FieldName | String | user_name | 欄位名。 |
| GeoClass | String | {xxx:xxx} | 地理資訊。 |
| FieldType | String | INTEGER | 欄位資料類型。 |
| TimeClass | String | HOUR/DAY/MONTH | 日期維度。 |
| Alias | String | user_name_alias | 欄位別名。 |
| DimDateClass | String | DAY | 調度類型。 |
| AstExpr | Array of AstExpr | 查詢條件。 |
|
| ExprType | String | binaryOp | 運算式類型。 |
| Expr | String | {"header":{"fieldName":"xxx"},"operator":"GreaterThanOrEqual","value":12345} | 運算式內容。 |
樣本
請求樣本
http(s)://iot.cn-shanghai.aliyuncs.com/?Action=GetDownloadFile
&IotInstanceId=iot-cn-npk1u******
&LongJobId=62d949808bc742187xxxxxx
&公用請求參數
正常返回樣本
XML格式
HTTP/1.1 200 OK
Content-Type:application/xml
<GetDownloadFileResponse>
<code/>
<data>
<asyncExecute>true</asyncExecute>
<csvFileName>download_file_name</csvFileName>
<csvUrl>https://insight-data-download-sh.oss-cn-shanghai.aliyuncs.com/data/download/6B761B2617454C9C9AAA0BF03D32C80E/62da39b9a48f865a7b953376/download_file_name.csv?Expires=1658469132&OSSAccessKeyId=xxxxxxxxx&Signature=rRL%xxxxxxx%3D</csvUrl>
<longJobId>62d949808bc742187xxxxxx</longJobId>
<status>1</status>
</data>
<requestId>41CF72F4-63C1-1EBA-8590-89D0F0CD298A</requestId>
<success>true</success>
</GetDownloadFileResponse>
JSON格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"code" : "",
"data" : {
"asyncExecute" : true,
"csvFileName" : "download_file_name",
"csvUrl" : "https://insight-data-download-sh.oss-cn-shanghai.aliyuncs.com/data/download/6B761B2617454C9C9AAA0BF03D32C80E/62da39b9a48f865a7b953376/download_file_name.csv?Expires=1658469132&OSSAccessKeyId=xxxxxxxxx&Signature=rRL%xxxxxxx%3D",
"longJobId" : "62d949808bc742187xxxxxx",
"status" : 1
},
"requestId" : "41CF72F4-63C1-1EBA-8590-89D0F0CD298A",
"success" : true
}
錯誤碼
| HttpCode | 錯誤碼 | 錯誤資訊 | 描述 |
| 400 | iot.dap.insight.noAuthorization | no authorization. | 此操作沒有許可權 |
| 400 | iot.dap.insight.requestParamError | request param error. | 請求參數異常。 |
| 400 | iot.dap.insight.serverError | server hsf error please try later | 後端HSF服務錯誤,請稍後重試 |
| 400 | iot.dap.insight.downloadTaskNumUpperLimit | the number of downloaded tasks exceeded the upper limit | 當天啟動並執行下載任務超過上限 |
| 400 | iot.dap.insight.downloadTimesUpperLimit | the number of current job downloaded tasks exceeded the upper limit | 當前任務當天下載次數超過上限 |
訪問錯誤中心查看更多錯誤碼。