Move a file between folders

This call moves a file from one folder to another. Moving of files is only allowed within the same project.

Request

https://api.sbgenomics.com/v2/files/{file_id}/actions/move
https://eu-api.sbgenomics.com/v2/files/{file_id}/actions/move

Example request

POST /v2/files/5f353aa0e4b08b38f159b956/actions/move HTTP/1.1
Host: api.sbgenomics.com
X-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74
Content-Type: application/json
curl --data '@move.json' -X POST -H "X-SBG-Auth-Token: 6282d5e2121d43e7900e9d52b15845e7" -H "Content-Type: application/json" 'https://api.sbgenomics.com/files'
from sevenbridges import Api

api = Api(url='https://api.sbgenomics.com/v2',
          token='3259c50e1ac5426ea8f1273259740f74')

file = api.files.get(id='5f353aa0e4b08b38f159b956')

# send POST request to SB API
moved_file = file.move_to_folder(
    parent='57ff702e1c94d72f08ba34e8',
    name='1000G_omni2.5.hg38.vcf'
)

print(moved_file.name, moved_file.id, moved_file.parent)

Header Fields

Name

Description

X-SBG-Auth-Token
required

Your Seven Bridges Platform authentication token.

Content-Type
required

application/json

Request body

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

Name

Data type

Description

parent
required

String

Specifies the target folder by using its ID.

To find out the folder ID, use the list folder contents call for its parent folder.

name

String

Specifies 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 Seven Bridges Platform-specific response codes that may be contained in the body of the response.

Example response body

{
    "href": "https://api.sbgenomics.com/v2/files/5f353aa0e4b08b38f159b956",
    "id": "5f353aa0e4b08b38f159b956",
    "name": "1000G_omni2.5.hg38.vcf",
    "size": 1787,
    "project": "rfranklin/my-project",
    "parent": "57ff702e1c94d72f08ba34e8",
    "type": "file",
    "created_on": "2020-08-13T13:05:36Z",
    "modified_on": "2021-02-22T14:26:36Z",
    "storage": {
        "type": "PLATFORM",
        "hosted_on_locations": [
            "aws:us-east-1"
        ]
    },
    "origin": {},
    "tags": [],
    "metadata": {
        "library_id": "1134",
        "sample_id": "10987"
    }
}