Copying a Folder

You can use the copyFile call to copy a folder. All files and subfolders will be copied.

Sample URL

https://hostname:port/context/rest/v2/documents/copyFolder/{id}

Method

POST

Parameters

Parameter Description
id Required.

The document ID of the folder

targetId Optional.

The document ID of the destination folder. The default value is the root folder.

name Optional.

The new name of the folder. The default value is to use the existing name.

sourcePath Optional.

This parameter is required if the id parameter is not presented in the URL. if the id parameter is presented, this parameter will be ignored.

This parameter points to a source folder. For example, sourcePath=/Presentation; here Presentation is a folder name.

targetPath Optional.

Instead of the targetId parameter, you can send the targetPath parameter, for example, targetPath=/Marketing/Demo, and then the folder will be copied into the /Marketing/Demo folder.

Response

HTTP Status Code Description
200 The call is executed successfully.

The format of the response is {"source":{<sourceDocument>},"target":{<copiedFolderDocument>}}.

Example:

{"source":{"dateModified":0,"users":"O:user2:A:user2;O:user1:P:user1","shareExpiration":1406433599960,"type":"D","lastUpdatedOn":1405699718960,"size":0,"id":"147I0000000A","createdOn":1405696509960,"parentId":"147I00000008","latestVersion":1,"shareId":"147I0000000A","createdBy":"user2","name":" Second level"},"target":{"createdOn":1405701491074,"id":"147I00000011","latestVersion":0,"parentId":"143Q00000037","dateModified":0,"users":"O:user2:A:user2","createdBy":"user2","shareId":"143Q00000037","name":"Second level 2","type":"D","size":0}}

400 An error occurs.

Example:

{"message":"There is duplicated file or folder name in the target folder!"}