Copy files between projects

/files/copy

This call allows you to copy a list of files at a time between projects.

Files are specified by their IDs, which you can obtain by making the API call to list all files accessible to you.

https://cgc-api.sbgenomics.com/v2/files/copy

Request

Example request

POST /v2/files/copy HTTP/1.1
Host: cgc-api.sbgenomics.com
X-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74
curl --data '{"project": "RFranklin/my-project", "files": ["56534e57e4b093830b6e9681", "560567b8e4b00cd40d0c9236", "56056792e4b092bac639b84e"]}' -s -H "X-SBG-Auth-Token: 6282d5e2121d43e7900e9d52b15845e7" -H "content-type: application/json" -X POST "https://cgc-api.sbgenomics.com/v2/files/copy"

Request body

In the body, you should enter a list of key-value pairs. The keys, and the values they take, are described in the following table. See also the example request body on the right.

KeyData type of valueDescription of value
project_IDstringThe ID of the project you want to copy into.
filesstringAn array of IDs for the files you want to copy.

Example request body

{
  "project": "RFranklin/my-project",
  "files": [
    "56534e57e4b093830b6e9681",
    "560567b8e4b00cd40d0c9236",
    "56056792e4b092bac639b84e"
  ]
}

👍

File IDs

Note that file IDs are dependent on the projects that they are in. When you copy a file to a different project, its ID changes.

Header Fields

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

Query parameters

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

Response

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

Example response body

{
    "56028d95e4b0be2f1afae512" : {
      "status": "OK",
      "new_file_id": "52d69fc0e4b0a77ec4fd2079"
    },
    "560567b8e4b00cd40d0c9236" : {
      "status": "OK",
      "new_file_id": "52d69fbde4b0a77ec4fb8738"
    },
    "56056792e4b092bac639b84e" : {
      "status": "OK",
      "new_file_id": "55b89899e4b091df2925371e"

    }
}
Language