Get Started
Portal api methods
Help

POST api/2.0/files/{folderId}/upload/create_session This function requires authentication

Description

Creates session to upload large files in multiple chunks.

Parameters
Name Description Type Example
folderId
sent in url
Id of the folder in which file will be uploaded string some text
fileName
sent in body
Name of file which has to be uploaded string some text
fileSize
sent in body
Length in bytes of file which has to be uploaded number 1234
relativePath
sent in body
Relative folder from folderId string some text
Remark

Each chunk can have different length but its important what length is multiple of 512 and greater or equal than 5 mb. Last chunk can have any size. After initial request respond with status 200 OK you must obtain value of 'location' field from the response. Send all your chunks to that location. Each chunk must be sent in strict order in which chunks appears in file. After receiving each chunk if no errors occured server will respond with current information about upload session. When number of uploaded bytes equal to the number of bytes you send in initial request server will respond with 201 Created and will send you info about uploaded file.

Example
POST api/2.0/files/some+text/upload/create_session
Host: yourportal.onlyoffice.com
Content-Type: application/json
Accept: application/json

{
  "fileName": "some text",
  "fileSize": 1234,
  "relativePath": "some text"
}
Returns

Information about created session. Which includes:

  • id: unique id of this upload session
  • created: UTC time when session was created
  • expired: UTC time when session will be expired if no chunks will be sent until that time
  • location: URL to which you must send your next chunk
  • bytes_uploaded: If exists contains number of bytes uploaded for specific upload id
  • bytes_total: Number of bytes which has to be uploaded