Create a folder

/files

This call creates a new folder.

Every project on the Seven Bridges Platform is represented by a root folder which contains all the files associated with a particular project. You can create nesting folders and subfolders within this root folder by using this API request.

Once you've created a folder, you can move or copy (coming soon) files between folders to populate your newly created folder.

To list the contents of the main project folder, first make the API request to get project details which will return the ID of the main folder (key: root_folder). Next, use the list folder contents call and specify this ID.

Request

https://api.sbgenomics.com/v2/files
https://eu-api.sbgenomics.com/v2/files

Example request

POST /v2/files HTTP/1.1
Host: api.sbgenomics.com
X-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74
Content-Type: application/json
curl -X POST -H "X-SBG-Auth-Token: c2e05946fb9a494ab5c19c72a94cb4ac" -H "Content-Type: application/json" -d '{
    "name" : "my_new_folder",
    "type" : "folder",
    "parent": "57fb98c51c94d72f08ba0544"
}
from sevenbridges import Api

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

# send POST request to SB API
new_folder = api.files.create_folder(
    name='my_new_folder',
    parent='57fba0611c94d72f08ba0550'
)

print(new_folder.name, new_folder.id, new_folder.type)

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

name
required

String

The name of the folder. It shouldn't begin with "__".

type
required

Enum

folder

parent

String

Specifies the ID of the parent folder for the new folder.

You should either specify a parent folder or the project name (see list folder contents for instructions on how to find the folder ID).

project

String

Project ID (username/project_name).

You should either specify a project name or the parent folder ID.

Example request body

{
  "name": "my_new_folder", 
  "parent": "57fba0611c94d72f08ba0550",
  "type": "FOLDER"
}
{
  "name": "my_folder", 
  "project": "rfranklin/my-project",
  "type": "FOLDER"
}

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/57fba0611c94d72f08ba0550",
  "id": "5800b406e4b07ecb1445de83",
  "name": "my_new_folder",
  "parent": "57fba0611c94d72f08ba0550",
  "type": "FOLDER",
  "created_on": "2016-10-10T14:06:25Z",
  "modified_on": "2016-10-10T14:06:25Z"
}