Copy Folder
/documents/api/1.2/folders/{folderId}/copy
Copy a specified folder and its contents to a specified destination folder.
Request
- application/json
- application/xml
-
folderId: string
Globally unique identifier (GUID) for the folder.
-
accessToken(optional): string
Applink access token authorizing the current user to access this folder. This parameter is mandatory if
appLinkID
is used. It can be used as accessToken or AccessToken. -
appLinkID(optional): string
Applink ID authorizing the current user to access this folder. Any time the parameter
appLinkID
is used, a parameteraccessToken
must be provided as well. To work, this applink must have at least the contributor role granted. It can be used as appLinkID or AppLinkID. -
dAccessCode(optional): string
Access code needed to use protected public links. It needs to be sent as part of a Cookie header in the following format:
dAccessCode-<linkID>=<passcodeValue>
-
linkID(optional): string
Public link ID of a public link authorizing the current user to access this folder. To work, this public link must have the contributor role granted. It can be used as linkID or LinkID.
object
-
destinationID:
string
(Required) Specify the globally unique identifier (GUID) of the destination folder.
-
duplicateResolution(optional):
string
(Optional) Specify the TimeStampSuffix option. The name of the copied folder is given a 6-digit suffix from the system timestamp.
{
"destinationID":"FB4CD874EF94CD2CC1B60B72T0000000000100000001"
}
Response
- application/json
- application/xml
200 Response
The request was fulfilled.
object
-
destinationID(optional):
string
Globally unique identifier (GUID) of the destination folder.
-
errorCode(optional):
string
An error code of zero (0) indicates no errors.
-
id(optional):
string
Globally unique identifier (GUID) of the newly created folder.
-
idList(optional):
string
Globally unique identifier (GUID) of the original folder.
-
type(optional):
string
Item type
folder
.
{
"destinationID":"FB4CD874EF94CD2CC1B60B72T0000000000100000001",
"id":"FCD4D4A73FA2317583B7C3BFT0000000000100000001",
"idList":"F512DA3911603E8AB84A07ACT0000000000100000001",
"type":"folder",
"errorCode":"0"
}
400 Response
Request parameters are not formatted correctly.
403 Response
Forbidden if the user does not have read permission.
404 Response
Folder ID is not found.
Examples
The following example copies the specified folder to the specified destination.
POST .../folders/F512DA3911603E8AB84A07ACT0000000000100000001/copy
Request Header
None.
Request Body
{ "destinationID": "FB4CD874EF94CD2CC1B60B72T0000000000100000001" }
HTTP Status Code
HTTP_STATUS = 200
JSON Response
{ "destinationID": "FB4CD874EF94CD2CC1B60B72T0000000000100000001", "errorCode": "0", "id": "FCD4D4A73FA2317583B7C3BFT0000000000100000001", "idList": "F512DA3911603E8AB84A07ACT0000000000100000001", "type": "folder" }
Example 2
The following example copies the specified folder to the specified destination. The example uses a public link ID because this folder is under a folder structure not owned by or shared with the current user.
POST .../folders/F81175D40FF57F19884AED0CB5D17B95F47087F4E518/copy
Request Header
LinkID: LF8D36FAFAB4388BECEAC4AEB5D17B95F47087F4E518
Request Body
{ "destinationID": "FBB72C3E28BBD1A7BCB264E1B5D17B95F47087F4E518" }
HTTP Status Code
HTTP_STATUS = 200
JSON Response
{ "destinationID": "FBB72C3E28BBD1A7BCB264E1B5D17B95F47087F4E518", "errorCode": "0", "id": "F140C834BF9484B69B26383AB5D17B95F47087F4E518", "idList": "F81175D40FF57F19884AED0CB5D17B95F47087F4E518", "type": "folder" }
Example 3
The following example copies the specified folder to the specified destination. The example uses a public link ID protected by an access code because this folder is under a folder structure not owned by or shared with the current user. An access code (test12345
) is submitted as part of a Cookie in the request header.
POST .../folders/F81175D40FF57F19884AED0CB5D17B95F47087F4E518/copy
Request Header
LinkID: LF8D36FAFAB4388BECEAC4AEB5D17B95F47087F4E518 Cookie: dAccessCode-LF8D36FAFAB4388BECEAC4AEB5D17B95F47087F4E518=test12345
Request Body
{ "destinationID": "FBB72C3E28BBD1A7BCB264E1B5D17B95F47087F4E518" }
HTTP Status Code
HTTP_STATUS = 200
JSON Response
{ "destinationID": "FBB72C3E28BBD1A7BCB264E1B5D17B95F47087F4E518", "errorCode": "0", "id": "F140C834BF9484B69B26383AB5D17B95F47087F4E518", "idList": "F81175D40FF57F19884AED0CB5D17B95F47087F4E518", "type": "folder" }
Example 4
The following example requests copying the specified folder to the specified destination. Because this folder is under a folder structure not owned by or shared with the current user, an access denied error message is returned.
POST .../folders/F81175D40FF57F19884AED0CB5D17B95F47087F4E518/copy
Request Header
None.
Request Body
{ "destinationID": "FBB72C3E28BBD1A7BCB264E1B5D17B95F47087F4E518" }
HTTP Status Code
HTTP_STATUS = 403
JSON Response
{ "destinationID": "FBB72C3E28BBD1A7BCB264E1B5D17B95F47087F4E518", "errorCode": "-20", "errorKey": "!csFldUnableToCopyItems!csCloudItemInsufficientPrivileges,User BB,fFolderGUID:F81175D40FF57F19884AED0CB5D17B95F47087F4E518,FLD_COPY", "errorMessage": "Unable to copy items. User 'User BB' has insufficient privilege to access fFolderGUID:F81175D40FF57F19884AED0CB5D17B95F47087F4E518 with service FLD_COPY.", "errorType": "folder", "idList": "F81175D40FF57F19884AED0CB5D17B95F47087F4E518", "title": "Unable to copy items. User 'User BB' has insufficient privilege to access fFolderGUID:F81175D40FF57F19884AED0CB5D17B95F47087F4E518 with service FLD_COPY.", "type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html" }
Example 5
The following example requests copying the specified folder to the specified destination. This folder is under a folder structure not owned by or shared with the current user, and only a public link protected by an access code is available. An error is returned because the access code was not submitted as part of the request.
POST .../folders/F81175D40FF57F19884AED0CB5D17B95F47087F4E518/copy
Request Header
LinkID: LF8D36FAFAB4388BECEAC4AEB5D17B95F47087F4E518
Request Body
{ "destinationID": "FBB72C3E28BBD1A7BCB264E1B5D17B95F47087F4E518" }
HTTP Status Code
HTTP_STATUS = 403
JSON Response
{ "destinationID": "FBB72C3E28BBD1A7BCB264E1B5D17B95F47087F4E518", "errorCode": "-18", "errorKey": "!csFldUnableToCopyItems!csAccessCodeRequiredForLinkAccess", "errorMessage": "Unable to copy items. The access code must be provided to access the link.", "errorType": "folder", "idList": "F81175D40FF57F19884AED0CB5D17B95F47087F4E518", "title": "Unable to copy items. The access code must be provided to access the link.", "type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html" }
Example 6
The following example copies the specified folder to the specified destination. The example uses an applink because this folder is under a folder structure not owned by or shared with the current user. The applink ID and access token are submitted in the request header.
POST .../folders/F64529EF770DCF96F029ED82B5D17B95F47087F4E518/copy
Request Header
appLinkID: LF5Bxj4TPo_p4n4qWn0tbKTicR2cTUJKv7X_ng9E7ry93rRuDokPqS1d6-wKwhb_wtcGYFDsI_cNMxeKQ-HR-FXQhiVoGRTYM_MPZY8qpICfYU94mmnMjM_cvsRhKMzc0NJgvwEJfqqDwPsAVrhc8cmg== accessToken: 352FpiMmW66PeYI1Gh5b83I9CXRwZhLfYAu4TXdqpzD8uNKUBMZVVJ3ZvivUW8kQ
Request Body
{ "destinationID": "FAD7A87F0613A0CBDD4DA521B5D17B95F47087F4E518" }
HTTP Status Code
HTTP_STATUS = 200
JSON Response
{ "destinationID": "FAD7A87F0613A0CBDD4DA521B5D17B95F47087F4E518", "errorCode": "0", "id": "F62E96098A6F9186F94730C1B5D17B95F47087F4E518", "idList": "F64529EF770DCF96F029ED82B5D17B95F47087F4E518", "type": "folder" }