API call description
Step 1: Call this API to get the file download information, including the download URL and headers. Step 2: Execute the download. See the following example:If the file is too large and you need to retrieve it in segments, add the headers field in the example above:
headers.put("Range","bytes=0-499");. For details, see Download partial content by specifying Range.Request
Basic information
| Field | Value |
|---|---|
| HTTP URL | https://api.dingtalk.io/v1.0/storage/spaces/{spaceId}/dentries/{dentryId}/downloadInfos/query |
| HTTP Method | POST |
| Supported app types | appType-Internal app |
| Required permissions | permission-Storage.DownloadInfo.Read-Read permission for download information of organization storage files |
Request header
| Name | Type | Required | Description |
|---|---|---|---|
| x-acs-dingtalk-access-token | String | Yes | The access credential for calling this API. Obtain it by calling the Get the access token of an internal app API. |
Path parameter
| Name | Type | Required | Description |
|---|---|---|---|
| spaceId | String | Yes | The space ID. Call the Add space API to obtain the id parameter value. |
| dentryId | String | Yes | The file ID. Call the Get the list of files or folders API or the Get spaceId by dentryUuid API to obtain the id parameter value. |
Query parameter
| Name | Type | Required | Description |
|---|---|---|---|
| unionId | String | Yes | The unionId of the operator. Call the Query user details API to obtain it. |
Request body
| Name | Type | Required | Description |
|---|---|---|---|
| option | Object | No | Optional parameters. |
| version | Long | No | The file version number. Call the Get the list of file versions API to obtain the version. |
| preferIntranet | Boolean | No | Whether to use intranet transmission preferentially. This parameter requires dedicated storage intranet transmission to be configured. - true: Yes (default) - false: No |
Request example
HTTPResponse
Response body
| Name | Type | Description |
|---|---|---|
| protocol | String | The file download protocol. - HEADER_SIGNATURE: Header signed request |
| headerSignatureInfo | Object | The header signed request information. This field takes effect when the protocol field value is HEADER_SIGNATURE. |
| resourceUrls | Array of String | Multiple download URLs. URLs listed earlier have higher priority. |
| headers | Map<String, String> | The request header information. |
| expirationSeconds | Integer | The expiration time, in seconds. |
| region | String | The region. - ZHANGJIAKOU: Zhangjiakou - SHENZHEN: Shenzhen - SHANGHAI: Shanghai - SINGAPORE: Singapore - UNKNOWN: Unknown |
| internalResourceUrls | Array of String | The intranet URLs. This field currently has no use case. Ignore it. |
Response body example
Error codes
If an error is returned when you call this API, find solutions based on the error message in the Global error codes document.| HttpCode | Error code | Error message | Description |
|---|---|---|---|
| 403 | orgAuthLevelNotEnough | auth level of org is not enough | The organization’s authentication level is too low. |
| 403 | permissionDenied | %s | The user lacks permission to download the file. |
| 400 | paramError | %s | Parameter error. |
| 400 | paramError.spaceId | %s | Parameter error - spaceId. |
| 400 | paramError.dentryId | %s | Parameter error - dentryId. |
| 400 | operationNotSupported | %s | The file does not support download. |
| 400 | dentryDownloadProtocolNotSupport | %s | The download protocol is not supported. |
| 400 | fileArchived | %s | The file is archived. Unarchiving is triggered automatically. Try again later. |
| 404 | spaceNotExist | %s | The space does not exist. |
| 404 | dentryNotExist | %s | The file does not exist. |
| 500 | systemError | %s | System error. |
| 500 | unknownError | Unknown Error | Unknown error. |
| 503 | operationTimeout | %s | The request timed out. |