跳到主要内容

abortUploadSession

abortUploadSession(sessionId, folderId)

DELETE /api/2.0/files/{folderId}/session/{sessionId}

Abort an upload session

Cancels a chunked upload opened with POST api/2.0/files/{folderId}/session and discards the parts already received, so nothing of it reaches the folder. The session is found by the id in the path alone: the folder segment is not matched against it, and neither is the account that opened it, which makes the id the only secret protecting the transfer. The call is destructive and is not safe to repeat, because the record is gone afterwards: a second attempt, a session already closed by PUT api/2.0/files/{folderId}/session/{sessionId}/finalize and a session that expired after twelve hours of silence all fail rather than answer as missing. Finalizing removes the session too, so there is nothing left to abort once the file exists. The answer carries no body. An upload that is simply abandoned needs no call at all, since the session and its buffered parts are dropped when it expires.

Parameters​

NameInTypeDescriptionNotes
sessionIdpathStringThe session to cancel, as returned in id when it was created: a 32-character hexadecimal string that identifies the session on its own.[required] [example: 9f1c7a2b4d3e4f5a8b6c0d1e2f3a4b5c]
folderIdpathInteger (int32)The folder the session was opened against. It is part of the route only and is not matched against the session, which is found by its own id.[required] [example: 1]

Responses​

Status codeDescriptionTypeResponse headers
200The session and the parts received so far have been discarded-X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
403The session was opened by another account--
404No open session with the specified ID: it never existed, was finalized or aborted, or has expired--
401UnauthorizedErrorApiResponse-
429Too Many Requests.ErrorApiResponseRetry-After
500Internal Server Error.ErrorApiResponse-
400Bad Request.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​

null (empty response body)

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 the session was opened against. It is part of the route only and is not matched against the session, which is found by its own id.[required] [example: sbox-42]

Authorization​

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

HTTP request headers​

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