This call lets you perform a bulk move operation of files and folders. You can move files or folders:
- to a root project folder
- to a subfolder within the same project or a different project
Rules for moving files and folders
- The file ID is preserved after the move.
- The folder ID is changed after the move.
- The destination has to be an existing folder.
- If the target folder contains a folder with the same name, the contents of both folders will be merged.
- If a file with the same name already exists, the source file will be automatically renamed (by adding a numeric prefix).
- You need to have WRITE permissions for both the source and destination folders.
Request
https://cavatica-api.sbgenomics.com/v2/async/files/move
POST /v2/async/files/move
Host: cavatica-api.sbgenomics.com
X-SBG-Auth-Token: 3259c50e1ac5336ea8f1273259740f75
curl -X POST \
https://api.sbgenomics.com/v2/async/files/copy \
-H 'Content-Type: application/json' \
-H 'X-SBG-Auth-Token: d32c2976ffc04d0eb90c6c4fb2c0a465' \
-H 'af055f57c30a3e2d99c1fd42101f13da: ' \
-d '{
"items": [
{
"file": "5c6d3f30e4b038563238932f",
"parent": "5c6d3f30e4b038533235932f",
"project": "",
"name": "my-new-file"
},
{
"file": "5c6d3f30e4b038563238932b",
"parent": "",
"project": "rfranklin/destination-project",
"name": ""
},
{
"file": "5c6d3f30e4b0385632389331",
"parent": "",
"project": "rfranklin/destination-project",
"name": ""
}
]
}'
Header Fields
Name | Description |
---|---|
X-SBG-Auth-Token required | Your CAVATICA authentication token. |
Content-Type required | application/json |
Request body
Key | Data type | Description |
---|---|---|
file required | object | The ID of the file or folder you are moving. Use the API call for listing all files or folders to obtain the ID. |
parent | string | The ID of the folder you are moving files to. |
name | string | Enter the new name for the file or folder if you want to rename it in the destination folder. |
{
"items": [
{
"file": "5c6d3f30e4b038563238932f",
"parent": "5c6d3f30e4b038533235932f",
"project": "",
"name": "my-new-file"
},
{
"file": "5c6d3f30e4b038563238932b",
"parent": "2c6d3b10e4b038533235932g",
"name": ""
},
{
"file": "5c6d3f30e4b0385632389331",
"parent": "85c6d3f30e4b038533235932h",
"name": ""
}
]
}
Response
See a list of CAVATICA-specific response codes that may be contained in the body of the response.
Response body
Key | Data type of value | Description of value |
---|---|---|
type | string | The type of job, which is MOVE in the case of copying files. |
total_files | string | The total number of files which will be processed. You can obtain this information using the call for getting the details of a move job. |
state | string | The state is SUBMITTED at the time of making this call. |
result | string | This key will show the result if available at the time the call is made. Use the details of a move job to see more information. |
id | string | ID of this move job. |
failed_files | string | The number of failed files if that information is available at the time of the call. You can get details of a move job with a dedicated call. |
completed_files | string | The number of completed files if that information is available at the time of the call. You can get details of a move job with a dedicated call. |
{
"href": "https://cavatica-api.sbgenomics.com/v2/async/files/move/70714077692891136",
"id": "70714077692891136",
"result": [],
"type": "MOVE",
"state": "SUBMITTED",
"failed_files": 0,
"completed_files": 0,
"total_files": 0
}