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

Example request

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

NameDescription
X-SBG-Auth-Token
required
Your CGC authentication token.
Content-Type
required
application/json

Request body

KeyData typeDescription
file
required
objectThe 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.
parentstringThe ID of the folder you are copying files to.
namestringEnter 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

KeyData type of valueDescription of value
typestringThe type of job, which is COPY in the case of copying files.
total_filesstringThe total number of files which will be processed. You can obtain this information using the call for getting the details of a copy job.
statestringThe state is SUBMITTED at the time of making this call.
resultstringThis 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.
idstringID of this copy job.
failed_filesstringThe 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_filesstringThe 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.

Example response body

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