An endpoint that copies a specified file to a specified path. This can also cause renaming - it's an equivalent of Linux's cp command.
- Verb:
POST
- Path:
/file/copy
Query parameters:
| Name |
Value |
Default value |
Description |
source |
string |
required |
A path to a file which should be copy. |
destination |
string |
required |
A new path for the file. |
overwrite |
true or false |
false |
Whether to overwrite if there already is a file at the destination path. |
Responses:
204 No Content - when the file was successfully copied.
404 Not Found - when couldn't find the file or if the source is pointing to a directory.
409 Conflict - when there already is a file at the destination path but overwrite is set to false. Also if destination is an existing directory.
400 Bad Request - when the path is invalid or when the new path is invalid.
Extra info
The new path of the file should be also verified with isPathValid to make sure the outcome will be what user expects.
User can request to copy file /docs/private/poetry.md to /docs/private/hidden/art.md. It means that:
- Directory
hidden needs to be created.
- File
poetry.md needs to be copied as art.md to the hidden directory.
If the overwrite is set to true and the destination points to an already existing file, it will be overwritten.
An endpoint that copies a specified file to a specified path. This can also cause renaming - it's an equivalent of Linux's
cpcommand.POST/file/copyQuery parameters:
sourcedestinationoverwritetrueorfalsefalseResponses:
204 No Content- when the file was successfully copied.404 Not Found- when couldn't find the file or if the source is pointing to a directory.409 Conflict- when there already is a file at the destination path butoverwriteis set to false. Also if destination is an existing directory.400 Bad Request- when the path is invalid or when the new path is invalid.Extra info
The new path of the file should be also verified with
isPathValidto make sure the outcome will be what user expects.User can request to copy file
/docs/private/poetry.mdto/docs/private/hidden/art.md. It means that:hiddenneeds to be created.poetry.mdneeds to be copied asart.mdto thehiddendirectory.If the
overwriteis set totrueand the destination points to an already existing file, it will be overwritten.