Request
Basic information
| Field | Value |
|---|---|
| HTTP URL | https://api.dingtalk.io/v1.0/storage/spaces/{spaceId}/dentries/batchCopy |
| HTTP Method | POST |
| Supported app types | appType-Internal app appType-Third-party enterprise app |
| Required permissions | permission-Storage.File.Write-Storage file write 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 Obtain the access token of an internal app API. - For a third-party enterprise app, call the Obtain the access token of the authorized enterprise API. |
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
| spaceId | String | Yes | The ID of the space where the source files or folders are located. Call the Add space 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 |
|---|---|---|---|
| targetSpaceId | String | Yes | The ID of the space where the target files or folders are located. Call the Add space API to obtain the value of the id parameter. |
| targetFolderId | String | Yes | The ID of the target folder. The root folder ID is 0. Call the Get a list of files or folders API to obtain the value of the id parameter. |
| dentryIds | Array of String | Yes | The list of source file or folder IDs. Up to 3 IDs can be specified. Call the Get a list of files or folders or Get the spaceId and dentryId by dentryUuid API to obtain the value of the id parameter. |
| option | Object | No | Optional parameters. |
| conflictStrategy | String | No | The strategy for handling file or folder name conflicts. - AUTO_RENAME (default): Automatically rename. - OVERWRITE: Overwrite. - RETURN_DENTRY_IF_EXISTS: Return the existing file. - RETURN_ERROR_IF_EXISTS: Return an error if the file already exists. |
Request example
HTTPResponse
Response body
| Name | Type | Description |
|---|---|---|
| resultItems | Array | The result list of the batch copy operation for files or folders. |
| spaceId | String | The ID of the space where the source files or folders are located. |
| dentryId | String | The ID of the source file or folder. |
| async | Boolean | Indicates whether the task is asynchronous. - true: Yes. - false: No. If the folder being operated on has child nodes, the operation is processed asynchronously. |
| success | Boolean | Indicates whether the operation succeeded. - true: Succeeded. - false: Failed. This field is not returned for asynchronous tasks. |
| errorCode | String | The error reason. This field is not returned for asynchronous tasks. |
| taskId | String | The asynchronous task ID, which can be used to query the task execution status. |
| targetSpaceId | String | The target space ID. This field is returned for both synchronous and asynchronous operations, except in failure cases. |
| targetDentryId | String | The ID of the file or folder after copying. This field is returned for both synchronous and asynchronous operations, except in failure cases. |
Response body example
Error codes
If an error is returned when you call this API, refer to the Global error codes document for solutions based on the error message.| HttpCode | Error code | Error message | Description |
|---|---|---|---|
| 400 | operationConcurrentControl | %s | Concurrency control. |
| 400 | paramError | %s | Parameter error. |
| 400 | paramError.spaceId | %s | Parameter error - spaceId. |
| 400 | paramError.dentryIds | %s | Parameter error - dentryIds. |
| 400 | paramError.targetSpaceId | %s | Parameter error - targetSpaceId. |
| 400 | paramError.targetFolderId | %s | Parameter error - targetFolderId. |
| 400 | paramError.conflictStrategy | %s | Parameter error - conflictStrategy. |
| 400 | spaceQuotaInsufficient | %s | Insufficient space quota. |
| 400 | sceneQuotaInsufficient | %s | Insufficient scene quota. |
| 400 | appQuotaInsufficient | %s | Insufficient app quota. |
| 400 | orgQuotaInsufficient | %s | Insufficient organization quota. |
| 400 | dentryAlreadyExist | %s | A file with the same name already exists. |
| 403 | permissionDenied | %s | The user does not have permission to copy the file or folder. |
| 404 | spaceNotExist | %s | The space containing the source file (or folder) or the target folder does not exist. |
| 404 | dentryNotExist | %s | The source file (or folder) or the target folder does not exist. |
| 500 | systemError | %s | System error. |
| 500 | unknownError | Unknown Error | Unknown error. |
| 503 | operationTimeout | %s | Request timed out. |