File upload
Upoading a file for temporary storage.
To upload a file, you need to generate a uuid and pass it as a unique hash value for the file's body.
To upload the entire file, use the Content-Range header with the following value: bytes 0-[size]\/[size] (for example, bytes 0-1000/1000).
You can also load the file by parts. To do that, divide the file into equal parts of 5 MB minimum each. The last part can be of any size.
The size of each such part must be between 5 MB (5 242 880 byte) and 5 GB (5 368 709 120 byte).
To let the server know which part is being uploaded, use the Content-Range header. Header template: bytes [range-start]-[range-end]\/[size]. (for example, bytes 0-5242880/7340032 to upload the first part of 5 MB for a 7 MB file, and bytes 5242880-7340032/7340032 to upload the second part of this file)
Next, initialize the file or it will be deleted (temporary storage is only available for 1 hour). To initialize the file, use the /disk/file/move endpoint by placing it in the directory or saving in the app.
The Content-Type header must have the following value: application/octet-stream.
In the file body, pass binary data.
Request
POST /pub/v1/disk/file/upload
Query parameters
Parameter name | Value | Description | Additional |
---|---|---|---|
hash | uuid | Hash of a file loaded by parts |
Required |
Form parameters
Parameter name | Value | Description | Additional |
---|---|---|---|
File | file | name: 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 has been loaded completely |
|
206 | Partial Content The part of the file has been loaded |
|
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 smal; InvalidPart is 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. |
|
default | Response after one of the file parts is uploaded |
Response after one of the file parts is uploaded (File upload) |