Moving a folderSince 8/2015
Added by IBM contributorElizabeth Bowling | Edited by IBM contributorElizabeth Bowling on September 18, 2015
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars1 comment

Move a folder to another location.

You can move a folder so that it becomes the child of another folder, a top-level community folder, or a top-level folder in the user's My File Sync.

When making the request, the body should never be empty; in the body the "category" setting should be set to "collection" as shown in the sample request.

This method requires authentication.

Input
Method URI Description
POST /files/{auth}/api/collection/{collection-id} Move a folder so it becomes a child of the specified folder.
POST /files/{auth}/api/communitycollection/{community-id}/feed Move a folder so it becomes a top-level folder in the specified community.
POST /files/{auth}/api/myfilesync/feed Move a folder so it becomes a top-level folder in the user's My File Sync.
POST /files/{auth}/api/collections/feed Move a folder to the top level of the user's personal folders.
Content Type: application/atom+xml
Sample Request:
<entry xmlns:td="urn:ibm.com/td" xmlns="http://www.w3.org/2005/Atom">
     <category term="collection" scheme="tag:ibm.com,2006:td/type" label="collection"></category>
     <td:itemId xmlns:td="urn:ibm.com/td">25badd1b-7d33-4ada-9ac9-1e126f0b47a3</td:itemId>
     <td:source xmlns:td="urn:ibm.com/td">
          <td:type xmlns:td="urn:ibm.com/td">collection</td:type>
          <td:itemId xmlns:td="urn:ibm.com/td">b3d1b2d0-eeff-463c-8759-423b9971dd2e</td:itemId>
     </td:source>
</entry>
Name Type Optional Description
auth
enumerated No The authorization protocol being used by your application to access Connections Cloud.
Authorized values:
  • basic
  • oauth
collection-id
string No The UUID of the folder in which the moved folder will be stored.
community-id
string No The UUID of the community folder to which the folder should be moved.
Name Type Optional Description
removePrivateFiles
enumerated Yes Indicate whether to remove private files from the folder before moving it. The default value is false.
Authorized values:
  • true
  • false
makeMinePublic
enumerated Yes Indicate whether to make owned files public before moving the folder. The default value is false.
Authorized values:
  • true
  • false
removeReshareOff
enumerated Yes Indicate whether files for which reshare is disabled should be removed from the folder before the folder is moved. The default value is false.
Authorized values:
  • true
  • false
category
enumerated No Only "collection" is supported in this operation.
Authorized values:
  • collection
itemId
string No The UUID that uniquely identifies the folder to move.
source
string No Indicates the source collection of the document.
sourceType
enumerated No Identifies the type of source collection: "collection" when it is typical collection with a collection UUID, or a personal top-level collection; "communityroot" when it is root of community collection; "mfdroot" when it is root of My FileSync; "personalroot" when it is root of personal root collection.
Authorized values:
  • collection
  • communityroot
  • mfdroot
  • personalroot
Name Type Optional Description
Authorization
enumerated No The authentication mechanism selected by your application to access the API.
Basic is the Base64 encoding of the IBM Connections Cloud username and password: Base64(username:password). For example, Base64(twatson@us.ibm.com:password).
Bearer is the oauth 2.0 access token that is generated when the user grants your application access to IBM Connections Cloud services.
See the reference topic "OAuth 2.0 APIs for web server flow" for more information.
Authorized values:
  • basic
  • bearer
Output
Code Description
204
The folder was successfully moved.
500
Internal server error. The server encountered an unexpected condition that prevented it from fulfilling the request.
401
Unauthorized. Returned when no authenticated user or no userid, email, or key parameter are provided on the request.
403
Forbidden. The server refuses to fulfill a request, typically because the request was for an object that you don't have permission to access.
409
The move failed due to a conflict with an existing resource; for example, a folder with the same name exists in the target location.
400
Bad Request. Returned when no matching user record can be found. For this API, the following situations will also result in a return code 400:
- Attempting to move a folder that contains private files to a public location
- Attempting to move a folder that contains files with reshare disabled
- Attempting to move a folder to a different community
=============
Response body
=============
---------------------------------------------------
PrivateFilesNotAllowedInPublicCollection
---------------------------------------------------
<td:error xmlns:td="urn:ibm.com/td">
<td:errorCode xmlns:td="urn:ibm.com/td">ConstraintViolation</td:errorCode>
<td:errorMessage xmlns:td="urn:ibm.com/td">EJPVJ9611E: Unable to move the collection with ID 6d4532fd-48cf-44d2-a21d-68329560277e to target collection with ID 406f11c4-a30b-4af2-8106-d7108d42767d.</td:errorMessage>
<td:violationType xmlns:td="urn:ibm.com/td">PrivateFilesNotAllowedInPublicCollection</td:violationType>
</td:error>
-------------------------------
ReshareFilesNotAllowed
-------------------------------
<td:error xmlns:td="urn:ibm.com/td">
<td:errorCode xmlns:td="urn:ibm.com/td">ConstraintViolation</td:errorCode>
<td:errorMessage xmlns:td="urn:ibm.com/td">EJPVJ9611E: Unable to move the collection with ID 17540748-fcc1-49dd-9958-3f983936feeb to target collection with ID ea05adec-8468-4faf-a642-f729ea1687f0.</td:errorMessage>
<td:violationType xmlns:td="urn:ibm.com/td">ReshareFilesNotAllowed</td:violationType>
</td:error>
---------------
InvalidTarget
----------------
<td:error xmlns:td="urn:ibm.com/td">
<td:errorCode xmlns:td="urn:ibm.com/td">InvalidTarget</td:errorCode>
<td:errorMessage xmlns:td="urn:ibm.com/td"></td:errorMessage>
</td:error>
------------------------------
CollectionTypeMismatch
------------------------------
<td:error xmlns:td="urn:ibm.com/td">
<td:errorCode xmlns:td="urn:ibm.com/td">CollectionTypeMismatch</td:errorCode>
<td:errorMessage xmlns:td="urn:ibm.com/td"></td:errorMessage>
</td:error>
------------------------
SourceNotMovable
------------------------
<td:error xmlns:td="urn:ibm.com/td">
<td:errorCode xmlns:td="urn:ibm.com/td">SourceNotMovable</td:errorCode>
<td:errorMessage xmlns:td="urn:ibm.com/td"></td:errorMessage>
</td:error>
------------------------------------------
CrossCommunityMoveNotAllowed
------------------------------------------
<td:error xmlns:td="urn:ibm.com/td">
<td:errorCode xmlns:td="urn:ibm.com/td">CrossCommunityMoveNotAllowed</td:errorCode>
<td:errorMessage xmlns:td="urn:ibm.com/td"></td:errorMessage>
</td:error>
------------------------------
SharingIntentRestriction
------------------------------
<td:error xmlns:td="urn:ibm.com/td">
<td:errorCode xmlns:td="urn:ibm.com/td">SharingIntentRestriction</td:errorCode>
<td:errorMessage xmlns:td="urn:ibm.com/td"></td:errorMessage>
</td:error>
404
=============
Response body
=============
------------------
ItemNotFound
------------------
Bad request parameter:
<td:error xmlns:td="urn:ibm.com/td">
<td:errorCode xmlns:td="urn:ibm.com/td">ItemNotFound</td:errorCode>
<td:errorMessage xmlns:td="urn:ibm.com/td">The request parameter itemId : 111 is invalid.</td:errorMessage>
</td:error>
Bad collection ID:
<td:error xmlns:td="urn:ibm.com/td">
<td:errorCode xmlns:td="urn:ibm.com/td">ItemNotFound</td:errorCode>
<td:errorMessage xmlns:td="urn:ibm.com/td">Collection not found with id 222</td:errorMessage>
</td:error>
------------------------------
SourceParentNotFound
------------------------------
<td:error xmlns:td="urn:ibm.com/td">
<td:errorCode xmlns:td="urn:ibm.com/td">SourceParentNotFound</td:errorCode>
<td:errorMessage xmlns:td="urn:ibm.com/td">EJPVJ9926E: Unable to get the collection with the ID 84627e9e-706b-4d7c-8d4a-6673f4cb7f87.</td:errorMessage>
</td:error>
---------------------------
ItemToMoveNotFound
---------------------------
<td:error xmlns:td="urn:ibm.com/td">
<td:errorCode xmlns:td="urn:ibm.com/td">ItemToMoveNotFound</td:errorCode>
<td:errorMessage xmlns:td="urn:ibm.com/td">EJPVJ9926E: Unable to get the collection with the ID 84627e9e-706b-4d7c-8d4a-6673f4cb7f87.</td:errorMessage>
</td:error>
-----------------------------------
ItemSourceParentNotFound
-----------------------------------
<td:error xmlns:td="urn:ibm.com/td">
<td:errorCode xmlns:td="urn:ibm.com/td">ItemInSourceParentNotFound</td:errorCode>
<td:errorMessage xmlns:td="urn:ibm.com/td">EJPVJ9615E: Unable to get the collection with the label 24777dfc-71dc-4335-9af2-69ca088bab1a, type SUB_FOLDER and parent collection ID 63f26b75-9e92-4619-9a16-dc4396431b50.</td:errorMessage>
</td:error>
Erion Dreyer commented on Jul 20, 2016

Re: Moving a folder

The 1st URI described here gives a error no matter what.

POST /files/{auth}/api/collection/{collection-id} Move a folder so it becomes a child of the specified folder.

The right value for this method is

/files/{auth}/api/collection/{collection-id}/feed