Upload a File#

Puts a file into a given folder.

Endpoint#
 PUT https://api.cloudplan.net/api/file/upload

Note

The file size limit is 100MB for this api function.

Request Header Parameters#

file_name

The name of the file. If a file with this name already exists the new file will automatically receive an appendix with a incremented count. (e.g. logo (1).png) TODO: how to do special chars and spaces

pfid

Id of the folder where the file should be put. See List all Root Directories and List Folder Content.

Note

File content is put in the request body.

Reply Parameters#

JSON Reply#
{
    "folder_cp_id": "",
    "foldername": "",
    "file_cp_id": "",
    "filename": "",
    "filehash": "",
    "result": true
}

folder_cp_id | (string)

Id of the target folder from the request.

foldername | (string)

Name of the target folder for convenience.

file_cp_id | (string)

Id of the newly created file.

filename | (string)

Name of the file as stored in cloudplan. May differ from the supplied file name when an appendix was added or illegal characters were removed.

filehash | (string)

SHA256 hash of the file content.

In linux you can compare with the result of sha256sum. E.g.#
sha256sum logo.JPG
2cfbb94ec1f0e69c88fc489211eec34cfdc05d48ae3dc5c5b5ad89329835355e  logo.JPG

Example with curl#

With this api function files can be easily uploaded from the console using curl.

example with curl#
curl https://api.cloudplan.net/api/file/upload -H "api-key: 695f8c0c345e8fabb88c57c9086b0b76" -H "file_name:logo.JPG" -H "pfid:6319C982C7C0D952BFAA7347D212E57D" --upload-file logo.JPG

{"org_file_cp_id":"","folder_cp_id":"6319C982C7C0D952BFAA7347D212E57D","foldername":"big_files","file_cp_id":"696E1590541E123F5CAF8D1AB76B9535","filename":"logo.JPG","filehash":"2cfbb94ec1f0e69c88fc489211eec34cfdc05d48ae3dc5c5b5ad89329835355e","result":true}