Create a folder

/files

This call creates a new folder.

Every project on CAVATICA 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://cavatica-api.sbgenomics.com/v2/files

Request

Example request

POST /v2/files HTTP/1.1
Host: cavatica-api.sbgenomics.com
X-SBG-Auth-Token: 1e43fEXampLEa5523dfd14exAMPle3e5
Content-Type: application/json
curl -X POST -H "X-SBG-Auth-Token: 1e43fEXampLEa5523dfd14exAMPle3e5" -H "Content-Type: application/json" -d '{
    "name" : "my new folder",
    "type" : "folder",
    "parent": "567890abc8a5136ec6127063"
}

Header Fields

NameDescription
X-SBG-Auth-Token
required
Your CAVATICA 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": "567890abc8a5136ec6127063",
  "type": "FOLDER"
}

Response

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

Example response body

{
  "href": "https://cavatica-api.sbgenomics.com/v2/files/567890abc9b0307bc0414164",
  "id": "567890abc9b0307bc0414164",
  "name": "my new folder",
  "parent": "567890abc8a5136ec6127063",
  "type": "FOLDER",
  "created_on": "2016-10-10T14:06:25Z",
  "modified_on": "2016-10-10T14:06:25Z"
}
Language