Copy a file between projects

/v2/files/{file_id}/actions/copy

For general information on the API, including formatting, parameters, and pagination, please see the API Overview.

This call copies the specified file to a new project. Files retain their metadata when copied, but may be assigned new names in their target project.

To make this call, you should have copy permission within the project you are copying from.

https://cavatica-api.sbgenomics.com/v2/files/{file_id}/actions/copy

👍

file_ids

Recall from the API Overview that the file_id is a hexadecimal string.

You can get the file_id for an file by making the call to list files within a specified project (primary method)

Request

Example request

POST v2/files/567890abc4f3066bc3750174/actions/copy HTTP/1.1
Host: cavatica-api.sbgenomics.com
X-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74
curl --data '{"project": "RFranklin/my-project", "name": "new-file"}'  -s -H "X-SBG-Auth-Token: 7942f56901534434a054dafc3813bc96" -H "content-type: application/json" -X POST "https://cavatica-api.sbgenomics.com/v2/files/567890abc4f3066bc3750174/actions/copy"

Header Fields

NameDescription
X-SBG-Auth-Token
required
Your CAVATICA authentication token.

Path parameters

NameDescription
file_idThe ID for the file you are querying. It can be obtained by making the call to list your files (primary method).

Query parameters

NameData typeDescription
fieldsstringSelector specifying a subset of fields to include in the response.

Request body

The body should contain the following key-value pairs:

KeyDatatype of valueDescription of value
"project"
required
stringThe name of the project you want to copy the file to
"name"stringThe new name the file will have in the target project.
If its name will not change, omit this key.

Example request body

{
  "project": "RFranklin/my-project", 
  "name": "new-file"
}

Response

See a list of CAVATICA-specific response codes that may be contained in the body of the response.

Example response body

The response gives the full specification of the file, and its metadata.

{
  "href": "https://cavatica-api.sbgenomics.com/v2/files/567890abc4f3066bc3750174",
  "id": "567890abc4f3066bc3750174",
  "name": "new-file",
  "size": 68425,
  "project": "RFranklin/my-project",
  "created_on": "2016-01-13T11:41:00Z",
  "modified_on": "2016-01-13T11:41:00Z",
  "origin": {},
  "metadata": {
	  "sample_id": "E16201_pool35_L1756",
 	  "library_id": "hg19",
	  "platform_unit_id": "C18_99",
	  "platform": "IonTorrent",
	  "quality_scale": "sanger"
	}
}

Language