API call description
To obtain the download information, follow these steps: Step 1: Call this API to obtain the file download information, including the download URL and headers. Step 2: Perform the download. See the following example:If the file is too large and you need to retrieve the resource in segments, add the following header 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 type | appType-Internal app |
| Permissions required | permission-Storage.DownloadInfo.Read-Read permission for organization storage file download information |
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 Get node list API to obtain the dentryUuid of the Knowledge Base node, and then call the Get spaceId by dentryUuid API to obtain the spaceId. |
| dentryId | String | Yes | The file ID. Call the Get node list API to obtain the dentryUuid of the Knowledge Base node, and then call the Get spaceId by dentryUuid API to obtain the dentryId. |
query parameter
| Name | Type | Required | Description |
|---|---|---|---|
| unionId | String | Yes | The unionId of the operator. Obtain it by calling the Query user details API. |
request body
| Name | Type | Required | Description |
|---|---|---|---|
| option | Object | No | Optional parameters. |
| version | Long | No | The file version. Obtain it by calling the Get file version list API. |
| preferIntranet | Boolean | No | Whether to prioritize intranet transmission. To use this parameter, dedicated storage intranet transmission must be configured. - true (default): Yes - false: No |
Request example
HTTPresponse
response body
| Name | Type | Description |
|---|---|---|
| protocol | String | The file download protocol. - HEADER_SIGNATURE: Header sign request |
| headerSignatureInfo | Object | Header sign request information. Note 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 | Intranet URLs. Note This field is currently not in use. Ignore it. |
response body example
error code
If an error is returned when calling this API, look up the solution 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 authentication level is too low |
| 403 | permissionDenied | %s | The user lacks the 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 in the archived state. Unarchiving is automatically triggered. 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 | request timeout |