Moving a File

You can use the moveFile call to move a file.

Sample URL

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

Method

POST

Parameters

Parameter Description
targetId Optional.

The target folder document ID.

If the target folder is a top root folder, do not send this parameter.

id The source document ID.
sourcePath

If the id parameter is not presented in the URL, this field is required.

This parameter defines the path for the source document, for example, /test/file.txt.

targetPath This parameter is required if the target folder is not a root folder and the targetId parameter is not presented.

This parameter defines the target folder path, for example, /test2folder.

Response

This call returns the JSON object which represents the moved file document.

Example:

{"latestVersion":"3","id":"51cf5053-f105-4f0a-a42d-fef4d37df967","parentId":"4234324324343","name":"new file name","lastUpdatedOn":1371060725117}