V2.1 Download File


Download a file from an asset.


This API is available in EnOS 2.1.0 and above.

Operation Permissions


Before invoking this API, ensure that the service account has been authorized the policy that includes the following service(s) and action permission(s). For how to authorize the service account, see Managing Service Accounts.


Required Service

Required Operation Permission

Asset

Read

Request Format

GET https://{integration-address}/connect-service/v2.1/files?action=download

Note

{integration-address}: The gateway address of message integration service. Log in to the EnOS Management Console and find it in Help > Environment Information.

Request Parameters (URI)

Note

Use one of the following methods to specify the asset:

  • Include assetId in the request

  • Include productKey + deviceKey in the request

Name

Location (Path/Query)

Mandatory/Optional

Data Type

Description

orgId

Query

Mandatory

String

The organization ID which the asset belongs to. How to get orgId>>

fileUri

Query

Mandatory

String

The URI of the file. Format: enos-connect://xxxx

category

Query

Mandatory

String

The type of the file to be downloaded. The value feature stands for model definition and ota for OTA-related resources.

assetId

Query

Optional (See Note above)

String

The asset ID. How to get assetID>>

productKey

Query

Optional (See Note above)

String

The product key. To be used with deviceKey.

deviceKey

Query

Optional (See Note above)

String

The device key. To be used with productKey.

Request Parameters (Header)

Name

Mandatory/Optional

Data Type

Description

apim-accesstoken

Mandatory

String

The access token obtained via token authentication. For more information, see Get Access Token

Response Parameters

Name

Data Type

Description

The binary data stream of the file

output stream

The response will return an output stream of the returned file with the content dependent on the file.

Samples

Request Sample

url: https://{apigw-address}/connect-service/v2.1/files?action=download&orgId=yourOrgId&fileUri=yourFileUri&assetId=yourAssetId&category=feature
method: GET
requestHeader:
{
  "apim-accesstoken":"yourAccessToken"
}

SDK Samples


You can access the SDK samples for Connection Service on GitHub: