Create a folder

/files

This call creates a new folder.

Every project on the CGC 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 copy or move 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.

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

Request

Example request

POST /v2/files HTTP/1.1
Host: cgc-api.sbgenomics.com
X-SBG-Auth-Token: 3210a98c1db9318fa9d9273156740f74
Content-Type: application/json
curl -X POST -H "X-SBG-Auth-Token: 3210a98c1db9318fa9d9273156740f74" -H "Content-Type: application/json" -d '{
    "name" : "my new folder",
    "type" : "folder",
    "parent": "568e69abe9b0307bc0414164"
}

Header Fields

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

Request body

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

NameData typeDescription
name
required
StringThe name of the folder. It shouldn't begin with "__".
type
required
Enumfolder
parentStringSpecifies 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).
projectStringProject ID (username/project_name).

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

Example request body

{
  "name": "my new folder", 
  "parent": "568e69abe9b0307bc0414164",
  "type": "FOLDER"
}

Response

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

Example response body

{
  "href": "https://cgc-api.sbgenomics.com/v2/files/5800c606e4b07ecb1445de83",
  "id": "5800c606e4b07ecb1445de83",
  "name": "my new folder",
  "parent": "568e69abe9b0307bc0414164",
  "type": "FOLDER",
  "created_on": "2016-10-10T14:06:25Z",
  "modified_on": "2016-10-10T14:06:25Z"
}
Language