Skip to main content

Copy file

POST /api/v1/files/{fileId}/copy/{folderId} HTTP/1.1

Generates notifications:

  • Notification file copy for owner of the file.
  • Notification file unshare for share user, if the operation overwrites the file, shared to someone.
  1. Path parameters
ParameterDescription
fileIdThe ID of the source file.
folderIdThe ID of the target folder.
  1. Request parameters
ParameterDescription
conflictStrategyConflict resolution strategy (keep_both / overwrite / versioned)
saveAsTemplateSave document as template [Since 2017.03]
timezoneOffsetMinsTimezone to be used during the conversion process [Since 2017.03]
filenameOverride target file name [Since 2017.04]
  1. Response structure

See Get file Info Response structure.

  1. Example request
curl 'http://localhost:8080/api/v1/files/189382891/copy/189383004?conflictStrategy=keep_both' -i -X POST \
-H 'X-co-auth-token: 96045f5d0489536683333964aa663bed' \
-H 'Content-Type: application/x-www-form-urlencoded'
  1. Example response
HTTP/1.1 200 OK
X-co-request-id: 544f5a6c6b373242694c43394e4a4358
Content-Type: application/vnd.ncloudtech.cloudoffice.file+json;v=1;charset=UTF-8
Content-Length: 2397
{
"file": {
"id": "189383332",
"createdDate": "2022-04-06T15:59:47.000Z",
"creator": "testsrvdocs@tacos.devoffice.ru",
"creatorFsId": "5177189d266a4862ad93b1cda2f5ac2b",
"creatorFirstName": "r",
"creatorLastName": "t",
"creatorMiddleName": "f",
"fileSize": "20",
"filename": "testfile.txt",
"headRevisionId": "189383333",
"lastModifyingUserId": "testsrvdocs@tacos.devoffice.ru",
"lastModifyingUserFsId": "5177189d266a4862ad93b1cda2f5ac2b",
"lastModifyingUserFirstName": "r",
"lastModifyingUserLastName": "t",
"lastModifyingUserMiddleName": "f",
"mediaType": "text/plain",
"modifiedByMeDate": "2022-04-06T15:59:47.000Z",
"modifiedDate": "2022-04-06T15:59:47.000Z",
"ownerFsId": "5177189d266a4862ad93b1cda2f5ac2b",
"ownerId": "testsrvdocs@tacos.devoffice.ru",
"parentId": "189383004",
"properties": [
{
"id": "sharedParent",
"key": "sharedParent",
"value": "true"
}
],
"totalSize": "20",
"checksum": "e0e102b9ff40785fac8902d8bcbf2279",
"tree": "/docs-test-copyFileExample()-zm2d2cxJfP/New Folder/testfile.txt",
"ownerFirstName": "r",
"ownerLastName": "t",
"ownerMiddleName": "f",
"isVersion": false,
"originalFileIdOpt": null,
"creatorIsDeleted": false,
"editorIsDeleted": false,
"ownerIsDeleted": false,
"ownerAvatar": "a00bbb30-993e-4632-925f-152939195049",
"creatorAvatar": "a00bbb30-993e-4632-925f-152939195049",
"editorAvatar": "a00bbb30-993e-4632-925f-152939195049"
},
"links": [
{
"rel": "self",
"href": "http://localhost:8080/api/v1/files/189383332"
},
{
"rel": "download",
"href": "http://localhost:8080/api/v1/files/189383332/content"
},
{
"rel": "import",
"href": "http://localhost:8080/api/v1/files/189383332/import"
},
{
"rel": "preview",
"href": "http://localhost:8080/api/v1/files/189383332/preview"
},
{
"rel": "link",
"href": "http://localhost:8080/link/189383332"
}
]
}