Copies a file or directory.
Try it now
Test
RAM authorization
Request syntax
POST /v2/file/copy HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| domain_id |
string |
Yes |
The domain ID. |
|
| body |
object |
No |
The request body. |
|
| share_id |
string |
No |
The share ID. If you access a file through a share, include the |
7JQX1FswpQ8 |
| drive_id |
string |
No |
The drive ID. |
1 |
| file_id |
string |
Yes |
The file ID or folder ID. |
4221bf6e6ab43c255edc4463bf3a6f5f5d317406 |
| to_drive_id |
string |
No |
The ID of the destination drive. By default, this parameter is set to the value of |
1 |
| to_parent_file_id |
string |
Yes |
The ID of the destination parent folder. To copy a file or folder to the root directory, set this parameter to |
6520943DC261 |
| auto_rename |
boolean |
No |
Specifies whether to automatically rename the file if a file with the same name already exists in the destination folder. Default: false. |
true |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| domain_id |
string |
The domain ID. |
bj1 |
| drive_id |
string |
The drive ID. |
1 |
| file_id |
string |
The ID of the new file or folder. |
4221bf6e6ab43a255edc4463bffa6f5f5d317401 |
| async_task_id |
string |
The asynchronous task ID. This parameter is returned only for folder copy operations. Copying a folder is an asynchronous task. Use this ID with the GetAsyncTask operation to query the task status. |
000e89fb-cf8f-11e9-8ab4-b6e980803a3b |
Examples
Success response
JSON format
{
"domain_id": "bj1",
"drive_id": "1",
"file_id": "4221bf6e6ab43a255edc4463bffa6f5f5d317401",
"async_task_id": "000e89fb-cf8f-11e9-8ab4-b6e980803a3b"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.