All Products
Search
Document Center

IoT Platform:GetDownloadFile

更新時間:Sep 05, 2023

Queries the result of a download task that is used to download the data of tables.

Usage notes

  • You can obtain the download link of a download task up to three times per day.

  • A download link is valid for 5 minutes.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action

String

Yes

GetDownloadFile

The operation that you want to perform. Set the value to GetDownloadFile.

Context

Map

No

{"xxx";xxx}

The content of the request.

IotInstanceId

String

No

iot-cn-npk1u******

The ID of the instance. You can obtain the ID of the instance on the Overview page in the IoT Platform console.

Important
  • If your instance has an ID, you must configure this parameter. Otherwise, the call fails.

  • If the Overview page or the instance ID is not displayed in the IoT Platform console, ignore this parameter.

For more information about instances, see Overview.

LongJobId

String

Yes

62d949808bc742187xxxxxx

The task ID that is returned when you created the download task. For more information, see the CreateDownloadDataJob parameter of the CreateDownloadDataJob operation.

In addition to the preceding operation-specific request parameters, you must configure common request parameters when you call this operation. For more information about common request parameters, see Common parameters.

Response parameters

Parameter

Type

Example

Description

Code

String

200

The error code returned if the call fails. For more information about error codes, see Error codes.

ErrorMessage

String

no authorization.

The error message returned if the call fails.

RequestId

String

BB71E443-4447-4024-A000-EDE09934****

The ID of the request.

Success

Boolean

true

Indicates whether the call was successful. Valid values:

  • true: The call was successful.

  • false: The call failed.

Data

Object

The data that is returned.

Status

Integer

1

The status of the download task. Valid values:

  • -1: The download task is being initialized.

  • 0: The download task is running.

  • 1: The download task is executed

  • 2: The download task failed to be executed.

  • 3: The download task is submitted and pending execution.

  • 4: The download task is canceled.

LongJobId

String

62d949808bc742187xxxxxx

The ID of the download task.

BeginTime

Long

1658406464534

The time when the download task started.

AsyncExecute

Boolean

true

Indicates whether the query is asynchronous. Valid values:

  • true: The query is asynchronous.

  • false: The query is synchronous.

TotalCount

Long

100

The total number of entries returned.

EndTime

Long

1658406465000

The time when the download task ended.

PreviewSize

Integer

100

The number of entries per preview page.

PageNo

Integer

1

The page number.

PageSize

Integer

10

The number of entries per page.

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

The download link of the CSV file that is stored in an Object Storage Service (OSS) bucket. The download link is valid for 5 minutes.

CsvFileName

String

test_download_flie

The name of the CSV file

DatasetId

String

xxxxxx

The ID of the downloaded object.

ResultDataInString

String

{"a":123}

The result of the query.

Header

Array of Header

The details of the fields that are returned.

TypeClass

String

date

The type dimension.

FieldName

String

user_name

The name of the field.

GeoClass

String

{xxx:xxxx}

The geographic information.

FieldType

String

INTEGER

The type of the field.

TimeClass

String

HOUR/DAY/MONTH

The time dimension.

DimDateClass

String

DAY

The schedule type.

Alias

String

user_name_alias

The alias of the field.

Result

Array of Object

{"a":123}

QuerySetting

Object

The details of the query.

SelectedHeaders

Array of SelectedHeaders

The queried fields.

FieldName

String

user_name

The name of the field.

GeoClass

String

{xxx:xxx}

The geographic information.

FieldType

String

INTEGER

The type of the field.

TimeClass

String

HOUR/DAY/MONTH

The date dimension.

Alias

String

user_name_alias

The alias of the field.

DimDateClass

String

DAY

The schedule type.

AstExpr

Array of AstExpr

The query conditions.

ExprType

String

binaryOp

The type of the expression.

Expr

String

{"header":{"fieldName":"xxx"},"operator":"GreaterThanOrEqual","value":12345}

The content of the expression.

Examples

Sample requests

http(s)://iot.cn-shanghai.aliyuncs.com/?Action=GetDownloadFile
&IotInstanceId=iot-cn-npk1u******
&LongJobId=62d949808bc742187xxxxxx
&<Common request parameters>

Sample success responses

XML format

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&amp;OSSAccessKeyId=xxxxxxxxx&amp;Signature=rRL%xxxxxxx%3D</csvUrl>
        <longJobId>62d949808bc742187xxxxxx</longJobId>
        <status>1</status>
    </data>
    <requestId>41CF72F4-63C1-1EBA-8590-89D0F0CD298A</requestId>
    <success>true</success>
</GetDownloadFileResponse>

JSON format

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&amp;OSSAccessKeyId=xxxxxxxxx&amp;Signature=rRL%xxxxxxx%3D",
    "longJobId" : "62d949808bc742187xxxxxx",
    "status" : 1
  },
  "requestId" : "41CF72F4-63C1-1EBA-8590-89D0F0CD298A",
  "success" : true
}

Error codes

HttpCode

Error code

Error message

Description

400

iot.dap.insight.noAuthorization

no authorization.

You do not have permissions to perform the operation.

400

iot.dap.insight.requestParamError

request param error.

The specified request parameter is invalid.

400

iot.dap.insight.serverError

server hsf error please try later

An error occurred in the backend High-speed Service Framework (HSF) service. Try again later.

400

iot.dap.insight.downloadTaskNumUpperLimit

the number of downloaded tasks exceeded the upper limit

The number of download tasks that are executed on the current day exceeds the limit.

400

iot.dap.insight.downloadTimesUpperLimit

the number of current job downloaded tasks exceeded the upper limit

The number of downloads for the current download task on the current day exceeds the limit.

For a list of error codes, see Service error codes.