Transfer User Content

post

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

Transfer either all user (userID) content or a specific folder 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
Path Parameters
  • Specify the source userID from where all content will be transferred. User GUID or login can be used.

Body ()
The request body defines details of what folder will be transferred.
Root Schema : UserContentTransferBody
Type: object
User content transfer body defines what content will be transfered.
Show Source
  • (Optional) If not passed, then all users content is transfered to the specified targetUserID. If a globally unique identifier (GUID) for a folder is passed, then the folder is transfered to the specified targetUserID. Currently only one folder can be transfered per call.
  • (Required) Specify the destination userID where all content will be transferred. User GUID or login can be used.
Example Request (application/json)
{
    "targetUserID":"UserA",
    "idList":"FA8E5194EE2D2EB532237BA398B217802FF797DD1F8E"
}
Back to Top

Response

Supported Media Types

200 Response

The request was fulfilled.

Body ()
Root Schema : UserContentTransferResponse
Type: object
User content transfer response.
Show Source
Nested Schema : User
Type: object
User information
Show Source
Example Response (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.

Back to Top

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"
}

Example 5

The following example transfers a single folder from UserB to UserA. Only the folder identified by F73FC4CFD165BD76377E0F96E9E6E9FFE4BA8C72AB3F 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",
  "idList": "F73FC4CFD165BD76377E0F96E9E6E9FFE4BA8C72AB3F"
}

HTTP Status Code

HTTP_STATUS = 200

JSON Response

{
  "count": "1",
  "errorCode": "0",
  "idList": "F73FC4CFD165BD76377E0F96E9E6E9FFE4BA8C72AB3F",
  "items": [
    {
      "id": "F73FC4CFD165BD76377E0F96E9E6E9FFE4BA8C72AB3F",
      "type": "folder",
      "name": "transferFolder",
      "parentID": "FCAF58C2CE2809226608A7A0D470065164CFA8E5008C",
      "createdTime": "2022-06-07T21:16:38Z",
      "modifiedTime": "2022-06-07T21:17:51Z",
      "size": "27436",
      "childItemsCount": "3",
      "childFolderCount": "0",
      "childFileCount": "3",
      "createdBy": {
        "displayName": "ssvrint.userb",
        "id": "U50736B544D00DF1EED770AC72F1B43EEA1F",
        "loginName": "ssvrint.userb",
        "type": "user"
      },
      "modifiedBy": {
        "displayName": "ssvrint.cecsadmina",
        "id": "UB3646EFBB265068EB229B3BFB30A8BDA1F1",
        "loginName": "ssvrint.cecsadmina",
        "type": "user"
      },
      "ownedBy": {
        "displayName": "ssvrint.usera",
        "id": "UF23FCDFA872215F048C7EFE6B94D85A1DFA",
        "loginName": "ssvrint.usera",
        "type": "user"
      }
    }
  ],
  "sourceUser": {
    "displayName": "ssvrint.userb",
    "id": "ssvrint.UserB",
    "loginName": "ssvrint.userb",
    "type": "user"
  },
  "targetUser": {
    "displayName": "ssvrint.usera",
    "id": "ssvrint.UserA",
    "loginName": "ssvrint.usera",
    "type": "user"
  },
  "type": "folder"
}
Back to Top