Upload Start

Initialize a file upload. This will return the file_id to be used in the upload_data and upload_finish requests.

Request

POST https://api.cloudplan.biz/api/file/upload_start

{
    "file_name" : "..."      // (string, required) the name of the file to be uploaded
    "parent_id" : "..."      // (string, required) the folder id where the file should be uploaded to
    "node_id" : "..."        // (string, optional) node where the file should be uploaded to
                                if not specified a node will be picked automatically
    "file_size" : 0          // (integer, required) the exact file size in bytes that will be uploaded
}

Note: after the upload is finished the file may be assigned a new file_id,
    so the file_id generated here is only valid during the upload

Reply

{
    "result": true/false
    "reason": (on failure) any error code
    "file_id":          // (string) the file_id to be used in any subsequent upload_data and upload_finish requests
    "node_id":          // (string) the node that was either explicitly chosen or automatically picked
    "node_type":        // (integer) type of the node
                           0 = real node
                           1 = private cloud node
}

Error Codes

file_name_empty
parent_id_empty
root_folder_not_found
no_node
file_size_not_specified
user_has_no_access
file_already_exists

error codes from :doc:`api/user/login`