Community articleMoving a file to a different folderSince V5.5
Added by IBM contributorIBM on September 17, 2015
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

Move a file from one folder to a different folder.
You can move a file to a folder, a community folder, or the root of the user's My File Sync.

This method requires authentication.
Input
Method URI Description
POST /files/{auth}/api/collection/{collection-id}/feed Move a file to the specified folder.
POST /files/{auth}/api/communitycollection/{community-id}/feed Move the file to the specified community folder.
POST /files/{auth}/api/myfilesync/feed Move the file to the root of the user's My File Sync.
Content Type: application/atom+xml
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 to which the file should be moved.
community-id
string No The UUID of the community folder to which the file should be moved.
Name Type Optional Description
makeMinePublic
enumerated Yes String. When set true, the file will be made public before being moved. The default value is false.
Authorized values:
  • true
  • false
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 file was successfully moved.
500
Internal server error. The server encountered an unexpected condition that prevented it from fulfilling the request.
=============
Response body
=============
<td:error xmlns:td="urn:ibm.com/td">
<td:errorCode>Unknown</td:errorCode>
<td:errorMessage>Error: TimedOut</td:errorMessage>
</td:error>
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 file with the same name might already exist in the target folder.
=============
Response body
=============
<td:error xmlns:td="urn:ibm.com/td">
<td:errorCode xmlns:td="urn:ibm.com/td">ItemExists</td:errorCode>
<td:errorMessage xmlns:td="urn:ibm.com/td">EJPVJ9606E: Unable to move the media with ID 67f0888b-d920-4737-9fda-fca1a8300185 from source collection with ID 35cedbad-b6d7-4ff0-8e2f-7c0a1c7898d1 to target collection with ID adfc3c04-4fdf-45a1-b218-ca18cfa44e99.</td:errorMessage>
<td:relatedItemType xmlns:td="urn:ibm.com/td">collection</td:relatedItemType>
<td:relatedItemId xmlns:td="urn:ibm.com/td">0ced2761-29b6-4675-a3a1-f14ce078aa7a</td:relatedItemId>
</td:error>
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 200:
- Attempting to move a private file to a public folder
- Attempting to share a file that was shared with the user (reshare not allowed)
- Attempting to move a file 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 media 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 media 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>
-------------------------------
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
The file to be moved could not be found.
=============
Response body
=============
------------------
ItemNotFound
------------------
<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>
------------------------------
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 152397db-780f-4835-a958-192a80e3bc91.</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">EJPVJ9022E: Unable to get the media with ID 7f678b89-8ff0-4a9e-ba04-56d61417a87e.</td:errorMessage>
</td:error>
-------------------------------------
ItemInSourceParentNotFound
-------------------------------------
<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">EJPVJ9618E: Unable to get the media with ID 152397db-780f-4835-a958-192a80e3bc91in collection with ID 136089de-3b9c-44d3-b8a9-36ca23094ad9.</td:errorMessage>
</td:error>