Request
Basic information
| Field | Value |
|---|---|
| HTTP URL | https://api.dingtalk.io/v1.0/storage/spaces/{spaceId}/dentries/{dentryId}/openInfos/query |
| HTTP Method | POST |
| Supported app types | appType-Internal app appType-Third-party enterprise app |
| Permission required | permission-Storage.File.Read-Organization storage file read permission |
Request headers
| Name | Type | Required | Description |
|---|---|---|---|
| x-acs-dingtalk-access-token | String | Yes | The access credential for calling this API. Obtain it as follows: - For an internal app, call the Get the access token of an internal app API. - For a third-party enterprise app, call the Get the access token of an organization authorized to a third-party app API. |
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
| spaceId | String | Yes | The space ID. Call the Add a space API to obtain the value of the id parameter. |
| dentryId | String | Yes | The file ID. Call the Get a list of files or folders or Get spaceId and dentryId by dentryUuid API to obtain the value of the id parameter. |
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
| unionId | String | Yes | The unionId of the operator. Call the Query user details API to obtain the value of the unionid parameter. |
Request body
| Name | Type | Required | Description |
|---|---|---|---|
| option | Object | No | Optional parameters. |
| version | Long | No | The version number of the specified file. Call the Get a list of files or folders API to obtain the value of the id parameter. |
| type | String | No | The open mode of the file: - PREVIEW: Preview. Default value. - EDIT: Edit. |
| waterMark | Boolean | No | Whether a watermark is required: - true: Required. - false: Not required. Default value. Currently, only WPS-format files (Word, Excel, PPT, PDF) support watermarks. |
| checkLogin | Boolean | No | Whether to check the DingTalk sign-in state. This parameter takes effect only when the value of type is PREVIEW. - true: Check. The DingTalk sign-in state is verified when entering the page. If the user is not signed in, the page redirects to the sign-in page, and then continues to the current page after signing in successfully. - false (default): Do not check. The DingTalk sign-in state is not verified when entering the page, but the following restrictions apply: - Supports basic document formats (Word, Excel, PPT, PDF), some image formats (jpg, jpeg, jpe, png, gif, bmp, pcx, jiff, tiff, tif, ico, fax, wbmp, webp), and all types of audio and video files. The Forward, Edit online, Download, and other actions in the upper-right corner of the preview window are not supported. - Once obtained, the link can be accessed only once (per browser session). - Once obtained, the link automatically expires after 5 minutes of inactivity. |
Request example
HTTPResponse
Response body
| Name | Type | Description |
|---|---|---|
| url | String | The file link. |
| hasWaterMark | Boolean | Whether watermarks are supported: - true: Supported. - false: Not supported. |
Response body example
Error codes
If an error is returned when calling this API, look up the error message in the Global error codes document to find a solution.| HttpCode | Error code | Error message | Description |
|---|---|---|---|
| 400 | paramError | %s | Parameter error. |
| 400 | paramError.spaceId | %s | Parameter error - spaceId. |
| 400 | paramError.dentryId | %s | Parameter error - dentryId. |
| 400 | paramError.openType | %s | Parameter error - openType. |
| 400 | dentryEditNotSupport | %s | The file does not support editing. |
| 400 | dentryPreviewNotSupport | %s | The file does not support previewing. |
| 400 | dentryExtensionNotSupport | %s | The file extension is not supported. |
| 400 | fileViral | %s | Virus file. |
| 400 | fileMalicious | %s | Malicious file. |
| 403 | permissionDenied | %s | The user lacks the permission to read the file. |
| 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 timed out. |