The file is uploaded to the specified directory of the Files workspace. You must have enough disk space for the file to be saved. If there is a file with the same name in the directory, a postfix with a number will be added to the name, for example, (1).
To upload a file, you need to generate a UUID and pass it in the hash request parameter. This will be the file body ID.
You can upload a file in full or in parts. To upload the whole file, pass the Content-Range header with the value bytes 0-[size]/[size] (for example, bytes 0-1000/1000).
To upload a file in parts, you need to divide it. All parts must be of equal size, except for the last one. The size of the main parts must be between 5 MB (5 242 880 B) and 5 GB (5 368 709 120 B). The remaining part can be of any size.
To inform the server which of the parts is being uploaded, you need to pass the Content-Range header. It is set by the following template: bytes [range-start]-[range-end]/[size]. For example, to upload a 7 MB file, you’d need tp pass the following headers: bytes 0-5242880/7340032 for the first 5 MB part of the file and bytes 5242880-7340032/7340032 for the remaining part.

Request

POST /pub/v1/disk/directory/{id}/upload

Path parameters

Parameter name Value Description Additional
id uuid

Directory ID

Required

Query parameters

Parameter name Value Description Additional
Hash uuid

File body ID

Required

Form parameters

Parameter name Value Description Additional
File file

name: File
Uploaded file

Authorization

This request requires the use of one of following authorisation methods: API key

Response

The following HTTP status codes may be returned:

Status code Description Resource
200 OK

The file is fully uploaded

206 Partial Content

Part of the file is successfully uploaded

400 Bad Request

The error is shown as a message that describes the problem. The error message may contain the following codes: EntityTooSmall if the file is divided into parts that are too small; InvalidPart if one of the parts was not found in storage; InvalidPartOrder if the order of the parts in the file is invalid; NoSuchUpload if the upload was not found

402 Payment Required

Not enough disk space

403 Forbidden

No permissions to create a file

default

Server response after the file is uploaded to the directory

Server response after the file is uploaded to the directory (Load a file to a directory)