Files

Files are the heart of the Onehub service and are organized via Folders. You can create, retrieve, update, download, delete files. You can also list all files/folders in a folder or all files the a user has been invited to directly. All files are versioned. Creating a file in the same location of an identically named file will automatically create a new version of the previously existing file.

Files have Thumbnails. Thumbnails are image representations of a file in PNG format. They are 128 pixels on their largest side with the shorter side varying, based on the aspect ratio of the file. If the file is smaller than 128x128, the thumbnail will be exactly the same size as the file.

Create a File

Uploads a file to the folder specified via [id]in the Workspace specified via [workspace_id].

Onehub requires file uploads to be sent with the Content-Type header of multipart/form-data rather than application/json. Additionally, this header requires a boundary parameter to indicate the file contents in the post body (see your particular library’s documentation on how to achieve this). Your file will need to be encoded as multipart/form-data before being passed in as the file parameter. We recommend that you use an existing multipart library in your programming language of choice.

If a filename has characters that would render it invalid, the name will automatically be changed to one that is valid. For example, file/name.txt would be changed to file-name.txt.

Return

Returns the newly created file and a 201 if the call succeeds. Returns a 422 error with an error in the message body and an empty file object if an error occurs.

Retrieve a File

Retrieves the individual file object specified via [id] from the Workspace specified via [workspace_id].

Return

Returns the file object and a 200 if the call succeeds.

Download a File

Downloads the file specified via [id].

Returns

Returns the actual contents of the file.

Update a File

Updates the file object specified via [id] in the Workspace specified via [workspace_id].

Parameters

filename string The name of the file.

Return

Returns the updated file object and a 200 if the call succeeds.

Delete a File

Deletes the file specified via [id] in the Workspace specified via [workspace_id].

Return

Returns an empty message body and a 204 if the call succeeds. Returns a 404 with an error in the message body if a non-existent file [id] is provided.

List all Files

Lists all files within the Workspace specified via [workspace_id] in the folder specified by [id].

Return

Returns a paged array of folder/file objects, along with the containing folder object, and a 200 if the call succeeds.

List all Files from Direct Invitation

Users can be invited to a Workspace, folder, or file. When invited to a Workspace, a user is automatically granted access to the folders and files within it at their specified role. This endpoint only lists files that a user has been invited to directly, outside of a Workspace.

Return

Returns a paged array of file objects and a 200 if the call succeeds.