API call description
When retrieving information about files and folders, file size and file extension fields are not available for folders.Request
Basic information
| Field | Value |
|---|---|
| HTTP URL | https://api.dingtalk.io/v1.0/storage/spaces/{spaceId}/dentries/query |
| HTTP Method | POST |
| Supported app types | appType-Internal app appType-Third-party enterprise app |
| Permissions | permission-Storage.File.Read-Read permission for organization storage files |
Request header
| Name | Type | Required | Description |
|---|---|---|---|
| x-acs-dingtalk-access-token | String | Yes | The access credential used to call 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 parameter
| Name | Type | Required | Description |
|---|---|---|---|
| spaceId | String | Yes | The space ID. Call the Add a space API to obtain the value of the id parameter. |
Query parameter
| 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 |
|---|---|---|---|
| dentryIds | Array of String | Yes | The list of file or folder IDs. Up to 30 IDs are supported. 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. |
| option | Object | No | Optional parameters. |
| appIdsForAppProperties | Array of String | No | The list of specified app IDs. Up to 20 IDs are supported. Call the Get space information API to obtain the value of the ownerId parameter. - If this parameter is specified, the properties of the file or folder for the specified app are returned. - If this parameter is not specified, the properties of the file or folder for all apps are returned. |
| withThumbnail | Boolean | No | Whether to retrieve thumbnail information of the file. - true: Yes - false: No Retrieve as needed. Retrieving thumbnails increases the API response time. |
Request example
HTTPResponse
Response body
| Name | Type | Description |
|---|---|---|
| resultItems | Array | The list of file or folder information retrieved in batches. |
| spaceId | String | The ID of the space where the file or folder resides. |
| dentryId | String | The ID of the file or folder. |
| success | Boolean | Whether the file or folder was retrieved successfully. true indicates success. |
| errorCode | String | The error reason. |
| dentry | Object | The information of the file or folder. |
| id | String | The ID of the file or folder. |
| spaceId | String | The ID of the space where the file or folder resides. |
| parentId | String | The parent directory ID of the file or folder. The ID of the root directory is 0. |
| type | String | The type. - FILE: File - FOLDER: Folder |
| name | String | The name of the file or folder. |
| size | Long | The file size, in bytes. |
| path | String | The path of the file or folder. |
| version | Long | The version number of the file or folder. |
| status | String | The status. - NORMAL: Normal - DELETED: Trash - EXPIRED: Expired |
| extension | String | The file extension. |
| creatorId | String | The unionId of the creator. |
| modifierId | String | The unionId of the modifier. |
| createTime | String | The created time in ISO 8601 format. Example: 2022-07-29T14:55Z. |
| modifiedTime | String | The modified time in ISO 8601 format. Example: 2022-07-29T14:55Z. |
| properties | Object | The property information of the file or folder. |
| readOnly | Boolean | Whether the file or folder is read-only. - true: Yes - false: No |
| appProperties | Map<String, Array> | The properties for specific apps. |
| Array | The property list. | |
| name | String | The property name. |
| value | String | The property value. |
| visibility | String | The property visibility. - PUBLIC: Visible to all apps - PRIVATE: Visible only to the current app |
| uuid | String | The identifier field. |
| partitionType | String | The storage partition: - PUBLIC_OSS_PARTITION: Public cloud OSS storage partition - MINI_OSS_PARTITION: Dedicated Mini OSS storage partition |
| storageDriver | String | The driver type: - DINGTALK: DingTalk unified storage driver - ALIDOC: DingTalk Docs storage driver - SHANJI: Shanji storage driver - UNKNOWN: Unknown driver |
| thumbnail | Object | The thumbnail information. |
| width | Integer | The thumbnail width, in pixels. |
| height | Integer | The thumbnail height, in pixels. |
| url | String | The thumbnail URL. |
Response body example
Error codes
If the API call fails, locate the solution in the Global error codes document based on the error message.| HttpCode | Error code | Error message | Description |
|---|---|---|---|
| 400 | paramError | %s | Parameter error |
| 403 | permissionDenied | %s | The user lacks permission to retrieve information about the file or folder. |
| 404 | spaceNotExist | %s | The space does not exist. |
| 500 | systemError | %s | System error |
| 500 | unknownError | Unknown Error | Unknown error |
| 503 | operationTimeout | %s | request timed out |