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://api.sb.biodatacatalyst.nhlbi.nih.gov/v2/files/copy

Request

Example request

POST /v2/files/copy HTTP/1.1
Host: api.sb.biodatacatalyst.nhlbi.nih.gov
X-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74
curl --data '{"project": "RFranklin/my-project", "files": ["567890abc9b0307bc0414164", "567890abc1e5339df0414123", "567890abc4f3066bc3750174"]}' -s -H "X-SBG-Auth-Token: 6282d5e2121d43e7900e9d52b15845e7" -H "content-type: application/json" -X POST "https://api.sb.biodatacatalyst.nhlbi.nih.gov/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": [
    "567890abc9b0307bc0414164",
    "567890abc1e5339df0414123",
    "567890abc4f3066bc3750174"
  ]
}

👍

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 authentication token.

Query parameters

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

Response

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

Example response body

{
    "567890abc9b0307bc0414164" : {
      "status": "OK",
      "new_file_id": "567890abc8a5639cc6722063"
    },
    "567890abc1e5339df0414123" : {
      "status": "OK",
      "new_file_id": "567890abc3d8130ea4047731"
    },
    "567890abc4f3066bc3750174" : {
      "status": "OK",
      "new_file_id": "567890abc8a5136ec6127063"

    }
}