Copy a file between projects

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

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.

Note that Controlled Data files may not be copied to Open Data projects. To make this call, you should have copy permission within the project you are copying from.

https://cgc-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/568e69abe9b0307bc0414164/actions/copy HTTP/1.1
Host: cgc-api.sbgenomics.com
X-SBG-Auth-Token: 3210a98c1db9318fa9d9273156740f74
curl --data '{"project": "RFranklin/my-project", "name": "new-file"}'  -s -H "X-SBG-Auth-Token: 3210a98c1db9318fa9d9273156740f74" -H "content-type: application/json" -X POST "https://cgc-api.sbgenomics.com/v2/files/568e69abe9b0307bc0414164/actions/copy"

Header Fields

NameDescription
X-SBG-Auth-Token
required
Your CGC 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 CGC-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://cgc-api.sbgenomics.com/v2/files/568e69abe9b0307bc0414164",
  "id": "568e69abe9b0307bc0414164",
  "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": {
    "case_id": "TCGA-OR-A5K2",
    "case_uuid": "6D980942-119E-43A0-9B41-E84C3FB0BD1A",
    "days_to_death": 994,
    "disease_type": "Adrenocortical Carcinoma",
    "ethnicity": "Not available",
    "experimental_strategy": "Not available",
    "gender": "FEMALE",
    "investigation": "TCGA-ACC",
    "platform": "Hospital Record",
    "primary_site": "Adrenal Gland",
    "race": "WHITE",
    "vital_status": "Dead"
  }
}
Language