Copy a file between folders

/files/{file_id}/actions/copy

❗️

Heads Up!

This page documents the Advance Access version (think "beta" but with fewer bugs) of the folders functionality.

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

https://api.sb.biodatacatalyst.nhlbi.nih.gov/v2/files/{file_id}/actions/copy

Request

Example request

POST /v2/files/{file_id}/actions/copy HTTP/1.1
Host: api.sb.biodatacatalyst.nhlbi.nih.gov
X-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74
Content-Type: application/json
X-SBG-advance-access: advance
curl --data '{"project": "RFranklin/my-project", "name": "new-file", "parent: "57fb98c51c94d72f08ba0544"}'  -s -H "X-SBG-Auth-Token: 7942f56901534434a054dafc3813bc96" -H "content-type: application/json" -X POST "https://api.sb.biodatacatalyst.nhlbi.nih.gov/v2/files/568e69ade4b0307bc0464164/actions/copy"

Header Fields

NameDescription
X-SBG-Auth-Token
required
Your authentication token.
Content-Type
required
application/json
X-SBG-Advance-Access
required
advance

Request body

In the request body, you should enter the following list of key-value pairs:

NameData typeDescription
parent
required
StringSpecifies the target folder by using its ID.
To find out the folder ID, use the List folder contents call for its parent folder.
nameStringSpecifies a new name for a file in case you want to rename it.
If you want to use the same name, omit this key.

###Example request body

{
  "parent": "57ff702e1c94d72f08ba34e8", 
  "name": "1000G_omni2.5.hg38.vcf"
}

Response

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

Example response body

{
  "href": "https://api.sb.biodatacatalyst.nhlbi.nih.gov/v2/files/57fba0611c94d72f08ba0550",
  "id": "57ff71c71c94d72f08ba34ed",
  "name": "1000G_omni2.5.hg38.vcf",
  "size": 208485995,
  "project": "rfranklin/my-project-3",
  "parent": "57ff702e1c94d72f08ba34e8",
  "type": "FILE",
  "created_on": "2016-10-13T11:36:39Z",
  "modified_on": "2016-10-13T11:36:39Z",
  "storage": {
    "type": "PLATFORM"
  },
  "origin": {},
  "tags": [
    "WGS",
    "hg38"
  ],
  "metadata": {}
}