Transfer User Content

post

/documents/api/1.1/users/{userID}/transferContent

Transfer all user (userID) content to another user (targetUserID). During transfer, a new folder is created at the destination user's home folder (named 'Documents from {sourceUsername}') and all content is moved in there. After the transfer is finished, this new folder will be automatically shared with the source user.

To transfer user content, you must log in as an administrator.

Request

Supported Media Types
  • application/json
  • application/xml
Path Parameters
userID
Type: string
Required: true

Specify the source userID from where all content will be transferred. User GUID or login can be used.

Query Parameters
targetUserID
Type: string
Required: true

Specify the destination userID where all content will be transferred. User GUID or login can be used.

Response

Supported Media Types
  • application/json
  • application/xml
200 Response

The request was fulfilled.

Body
User content transfer response.
Root Schema : UserContentTransferResponse
User content transfer response.
Nested Schema : User
User information
Example application/json

{
    "errorCode":"0",
    "sourceUser":{
        "id":"U0EAA20910FAF3052ACB79E4T00000000001",
        "displayName":"User BB",
        "loginName":"userBBLoginName",
        "type":"user"
    },
    "targetUser":{
        "id":"U7ECC74059E0FEDFEC66BF5AT00000000001",
        "displayName":"User AA",
        "loginName":"userAALoginName",
        "type":"user"
    }
}
400 Response

Required field is not provided.

403 Response

Unauthorized access.

404 Response

Source and/or destination user is not found.

Examples

The following example transfers all UserB content to UserA. All content will be moved into a new folder called Documents From UserB, which will be created in the UserA home folder. This new folder will be shared with UserB automatically.

POST .../users/UserB/transferContent

Request Header

None.

Request Body

{
    "targetUserID": "UserA"
}

HTTP Status Code

HTTP_STATUS = 200

JSON Response

{
    "errorCode":"0",
    "sourceUser":{
        "displayName":"UserB",
        "id":"U0EAA20910FAF3052ACB79E4T00000000001",
        "loginName":"userBLoginName",
        "type":"user"
    },
    "targetUser":{
        "displayName":"UserA",
        "id":"U7ECC74059E0FEDFEC66BF5AT00000000001",
        "loginName":"userALoginName",
        "type":"user"
   }
}

Example 2

The following example requests the transfer of UserB content without a destination user.

POST .../users/UserB/transferContent

Request Header

None.

Request Body

None.

HTTP Status Code

HTTP_STATUS = 400

JSON Response

{
    "errorCode": "-97",
    "errorKey": "!csUnableToChangeItemOwner!csRequiredParameterMissing,dTargetUserID",
    "errorMessage": "Change of item ownership has failed. Parameter 'dTargetUserID' required by the requested service is missing.",
    "title": "Change of item ownership has failed. Parameter 'dTargetUserID' required by the requested service is missing.",
    "type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}

Example 3

The following example requests the transfer of UserB content to UserA logged in as UserA.

POST .../users/UserB/transferContent

Request Header

None.

Request Body

None.

HTTP Status Code

HTTP_STATUS = 403

JSON Response

{
    "errorCode": "-20",
    "errorKey": "!csUnableToChangeItemOwner!csCloudServiceInsufficientPrivileges,UserA,TRANSFER_USER_CONTENT",
    "errorMessage": "Change of item ownership has failed. User 'UserA' has insufficient privilege to run service TRANSFER_USER_CONTENT.",
    "sourceUserID": "UserB",
    "targetUserID": "UserA",
    "title": "Change of item ownership has failed. User 'UserA' has insufficient privilege to run service TRANSFER_USER_CONTENT.",
    "type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}

Example 4

The following example requests the transfer of UserB content to nonexistent UserAA.

POST .../users/UserB/transferContent

Request Header

None.

Request Body

{
    "targetUserID": "UserAA"
}

HTTP Status Code

HTTP_STATUS = 404

JSON Response

{
    "errorCode": "-16",
    "errorKey": "!csUnableToChangeItemOwner!csUserNotFound,UserAA",
    "errorMessage": "Change of item ownership has failed. User or group 'UserAA' doesn't exist.",
    "sourceUserID": "UserB",
    "targetUserID": "UserAA",
    "title": "Change of item ownership has failed. User or group 'UserAA' doesn't exist.",
    "type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}