跳到主要内容

createUploadSession

ChunkedUploadSessionResultWrapper createUploadSession(folderId, SessionRequest)

POST /api/2.0/files/{folderId}/upload/create_session

Chunked upload

Deprecated in favour of POST api/2.0/files/{folderId}/session, which opens the same session and returns it without the success envelope used here; new callers should go there. Reserves a chunked upload of a file in the folder named by the path: the title comes from fileName, the declared payload size from fileSize, and the answer carries the session id every later call quotes, the address of the standalone chunk handler, the moment an idle session is dropped and the reserved byte count. No content is stored yet. Send the payload as multipart parts to POST api/2.0/files/{folderId}/session/{sessionId}/upload, keeping each part within chunkUploadSize from GET api/2.0/files/settings, then close the session with PUT api/2.0/files/{folderId}/session/{sessionId}/finalize. The caller needs the right to add content to the target folder, which room managers and content creators have and readers, editors and guests do not: they get 403, as does a section root such as Rooms or Archive, while an unknown folder is answered as missing. A payload above the portal limit for chunked uploads is refused before the session exists.

Parameters​

NameInTypeDescriptionNotes
folderIdpathInteger (int32)The folder that receives the file; take the id from a listing such as GET api/2.0/files/@root. A room or an ordinary folder inside one is accepted, a section root is not.[required] [example: 1]
SessionRequestbodySessionRequestThe file the session is opened for, and how a clash with an existing name is settled.[required]

Responses​

Status codeDescriptionTypeResponse headers
200The created session, wrapped in the success envelopeChunkedUploadSessionResultWrapperX-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
400The request body cannot be read or has no fileName--
402The declared fileSize exceeds the portal limit for chunked uploads or the size allowed in a knowledge folder--
403The caller cannot add content to the target folder, the folder is a section root, or a knowledge folder does not accept this format--
404No folder with the specified ID--
415The installation restricts uploadable formats and the file extension is not among them--
401UnauthorizedErrorApiResponse-
429Too Many Requests.ErrorApiResponseRetry-After
500Internal Server Error.ErrorApiResponse-
502Bad Gateway. Returned by the reverse proxy, response body may be HTML and not JSON.--
503Service Unavailable. Returned by the reverse proxy, response body may be HTML and not JSON.--

Return type​

ChunkedUploadSessionResultWrapper

Third-party storage​

For a file or folder in a connected third-party storage the identifier is a string such as sbox-42, and the call differs in these parts only:

NameInTypeDescriptionNotes
folderIdpathStringThe folder that receives the file; take the id from a listing such as `GET api/2.0/files/@root`. A room or an ordinary folder inside one is accepted, a section root is not.[required] [example: sbox-42]

Return type: ThirdPartyChunkedUploadSessionResultWrapper

Authorization​

Basic, OAuth2 (scopes: read, write), ApiKeyBearer, asc_auth_key, Bearer, OpenId

HTTP request headers​

  • Content-Type: application/json
  • Accept: application/json