Introduction

Librarys

To use the DokuMe storage first you need this libraries

<script src="APPS/storage/resumable.js"></script>
<script src="APPS/storage/modules/storage-class.js"></script>

Used System Globals

Variable Type Description
app_name STRING Name of the active App
routingid INT ID of the actual client. NULL if user and ID if you are accessing a client

Init

Use this call to initiate the storage object for the APP which is displayed to the user. If you want to get Files from other APPS please change app_name to the App you need. RoutingId specifies the way from which client you are accessing the data.

# use for path global variable app_name to access APP container

var storage = new FileStorage(path, routingid, uploadBackend);

Get files

This function delivers a list of all files saved in the APP container.

# use for path global variable app_name to access APP container

storage.getFiles(path, callback, sharedOption);

Delete files

This function will delete a file by passing the file ID.

storage.deleteFile(fileId, callback);

Init upload files object

If you need to upload files in your APP you can initiate the upload function as follows:

storage.initResumable({
    uploadBTN: 'uploadFiles',
    browseBTN: 'browseButton',
    dropArea: 'dropArea',
    progressBarDIV: 'progressBarDIV',
    fileNameQuestion: false,
    resultsDIV: 'uploadContainer',
    success_callback: function() {

    }
});

Change default path for getting files

storage.setPath('new/path')

Change directory

You can organize your files in a folder structure. Therefore just set the folder ID to the function so next uploaded file will be associated with this.

storage.setFolder(folderId)

Get storage information of client

This function gives you information how much storage the user has.

storage.getStorageInfo(callback);

This function will return to you the file with ID passed to the function.

storage.searchFile(fileId)

Share files

Share a file with another user or client.

storage.shareFile(userID, fileID, callback)

Mention a person

With this function you can mention a person in the file.

storage.highlightPerson(fileId, name, type, dokumeId, callback)
Attribute Type Description
fileId INT ID of file
name STRING A string that should be associated with the mention
type INT Type of mention. It is up to you how you will use it
dokumeId INT DokuMe User ID (auth.config.id)
callback FUNCTION

Resize video

storage.resizeVideo(fileId, callback, deleteFile)

Create ZIP archive

storage.createZIP(zipName, params, callback)

Create Public URL for a file

storage.createPublicURL(fileId, callback)
# Generate signature for new public link
backend.get('publiclink/{fileId}[/{expireDate:YYYY-MM-DD HH:mm:ss}]', null, console.log, 'storage')

# Retrieve file with key
backend.getFunction('storage/publiclink/{signatur}', null, console.log, 'storage')

# Direct download
https://api.test.dokume.net/functions.php/storage/publiclink/${key}/download

# Show inline in Browser
https://api.test.dokume.net/functions.php/storage/publiclink/${key}/inline