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://cavatica-api.sbgenomics.com/v2/async/file/copy

Example request

POST /v2/async/files/copy
Host: cavatica-api.sbgenomics.com
X-SBG-Auth-Token: 3259c50e1ac5336ea8f1273259740f75
curl -X POST \
  https://cavatica-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

NameDescription
X-SBG-Auth-Token
required
Your CAVATICA 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": "5c6d3f30e4b038563238932f",
      "parent": "5c6d3f30e4b038533235932f",
      "name": "my-new-file"
    },
    {
      "file": "5c6d3f30e4b038563238932b",
      "parent": "5c6d3f30e4b038533235932f",
      "name": ""
    },
    {
      "file": "5c6d3f30e4b0385632389331",
      "parent": "5c6d3f30e4b038533235932f",
      "name": ""
    }
  ]
}

Response

See a list of CAVATICA-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://cavatica-api.sbgenomics.com/v2/async/files/copy/70714077692891136",
    "id": "70714077692891136",
    "result": [],
    "type": "COPY",
    "state": "SUBMITTED",
    "failed_files": 0,
    "completed_files": 0,
    "total_files": 0
}