Cubicl Docs
Search
K
Comment on page

Files

This document contains endpoints for
  1. 1.
    Uploading files to different parts of the app
  2. 2.
    Files feature in the projects

Uploading and Downloading

Files can be uploaded to tasks, task activities, chat messages, clients, and the files page. For all of these operations, first, you need to send a request to upload the file. After the upload completes, the server will return the id of the file. Then, you can use this id in other API endpoints.
post
https://cubicl.io/api/v1
/files/upload
Upload File

Files Page Endpoints

These endpoints allow you to view, create, edit and delete files and folders in the Files page of a project and a client.
Cubicl allows you to organize files and directories for both projects and also clients.
The structure of the Files page is similar to the file system in a computer or other file storage services such as Google Drive. It consists of nested file and directory nodes. At the top, a root directory node exists. Directories hold child file and directory nodes. File nodes are not same as the file record returned from Upload File endpoint. File node records point to file records.
get
https://cubicl.io/api/v1
/file-system-nodes
Get Nodes
post
https://cubicl.io/api/v1
/file-system-nodes/files
Create Files
post
https://cubicl.io/api/v1
/file-system-nodes/directories
Create Directory
delete
https://cubicl.io/api/v1
/file-system-nodes
Delete Nodes

Data

File

type File = {
_id: string;
name: string;
thumbnail?: string; // Link to thumbnail URL if file is a supported image
// If file is attached from Google Drive
google?: {
id: string;
extension: string;
webViewLink: string;
mimeType: string;
},
// If file is attached from Dropbox
dropbox?: {
id: string;
webViewLink: string;
}
}

File System Node

type FileSystemNode = {
_id : string;
// Parent directory id. null when parent is the root directory
parent: string | null;
group?: string; // Project id
customer?: string; // Cliend id
type: 'f' | 'd'; // f for file, d for directory
file: File | null; // File when type is 'f', null when type is 'd'
// Set when type is 'd'. If type is 'f', get name from 'file' property.
name?: string;
createdAt: number;
}