Copy multiple files
v2/async/file/copy
This call lets you perform a bulk copy operation of files and folders. Any underlying folder structure will be preserved. You can copy:
- to a folder within the same project
- to another project
- to a folder in another project
Request
https://cgc-api.sbgenomics.com/v2/async/files/copy
POST /v2/async/files/copy
Host: cgc-api.sbgenomics.com
X-SBG-Auth-Token: 3210a98c1db9318fa9d9273156740f74
curl -X POST \
https://cgc-api.sbgenomics.com/v2/async/files/copy \
-H 'Content-Type: application/json' \
-H 'X-SBG-Auth-Token: 3210a98c1db9318fa9d9273156740f74' \
-d '{
"items": [
{
"file": "568e69abe9b0307bc0412345",
"parent": "5c6d3f17d4b031029335932f",
"project": "",
"name": "my-new-file"
},
{
"file": "568e69abe9b0307bc0498765",
"parent": "",
"project": "rfranklin/destination-project",
"name": ""
},
{
"file": "5c6d3f30e5e7358295389331",
"parent": "",
"project": "rfranklin/destination-project",
"name": ""
}
]
}'
Header Fields
Name | Description |
---|---|
X-SBG-Auth-Token required | Your CGC 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 copying. Copying the the project root folder is not allowed. Use the API call for listing all files to obtain the ID. |
parent | string | The ID of the folder you are copying files to. |
name | string | Enter the new name for the file if you want to rename it in the destination folder. |
{
"items": [
{
"file": "568e69abe9b0307bc0412345",
"parent": "5c6d3f17d4b031029335932f",
"name": "my-new-file"
},
{
"file": "568e69abe9b0307bc0498765",
"parent": "5c6d3f17d4b031029335932f",
"name": ""
},
{
"file": "5c6d3f30e5e7358295389331",
"parent": "5c6d3f17d4b031029335932f",
"name": ""
}
]
}
Response
See a list of CGC-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 COPY 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 copy 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 copy job to see more information. |
id | string | ID of this copy 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 copy 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 copy job with a dedicated call. |
{
"href": "https://cgc-api.sbgenomics.com/v2/async/files/copy/71714077692891136",
"id": "71714077692891136",
"result": [],
"type": "COPY",
"state": "SUBMITTED",
"failed_files": 0,
"completed_files": 0,
"total_files": 0
}
Updated less than a minute ago