DeleteUploadHandler API¶
Deletes an upload handler and discards its staged temporary file on the server. Use this to clean up if a chunked upload is cancelled or if an error occurs before the upload is finalized with UploadDocumentWithHandler.
Endpoint¶
Methods¶
-
GET
/srv.asmx/DeleteUploadHandler?authenticationTicket=...&UploadHandler=... -
POST
/srv.asmx/DeleteUploadHandler(form data) -
SOAP Action:
http://tempuri.org/DeleteUploadHandler
Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
authenticationTicket |
string | Yes | Authentication ticket obtained from AuthenticateUser. |
UploadHandler |
string (GUID) | Yes | The handler GUID returned by CreateUploadHandler. Must be a valid GUID string. |
Response¶
Success Response¶
Error Response¶
Required Permissions¶
Any authenticated user may call this API.
Chunked Upload Workflow¶
Upload handlers stage large files on the server before they are committed to the document library. DeleteUploadHandler is the cleanup step:
-
CreateUploadHandler-" Allocate a handler and obtain theUploadHandlerGUID andChunkSize. -
UploadFileChunk-" Send the file in sequential chunks using the handler GUID. -
UploadDocumentWithHandler(orUploadDocumentWithHandler1/UploadNewDocumentWidthHandler) -" Finalize the upload and create the document or new version. -
DeleteUploadHandler-" Call this only if the upload is cancelled or fails before step 3 completes. After a successfulUploadDocumentWithHandlercall the handler is consumed automatically and does not need to be deleted manually.
Example¶
GET Request¶
GET /srv.asmx/DeleteUploadHandler
?authenticationTicket=3f2504e0-4f89-11d3-9a0c-0305e82c3301
&UploadHandler=a1b2c3d4-e5f6-7890-abcd-ef1234567890
HTTP/1.1
POST Request¶
POST /srv.asmx/DeleteUploadHandler HTTP/1.1
Content-Type: application/x-www-form-urlencoded
authenticationTicket=3f2504e0-4f89-11d3-9a0c-0305e82c3301
&UploadHandler=a1b2c3d4-e5f6-7890-abcd-ef1234567890
SOAP Request¶
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tns="http://tempuri.org/">
<soap:Body>
<tns:DeleteUploadHandler>
<tns:authenticationTicket>3f2504e0-4f89-11d3-9a0c-0305e82c3301</tns:authenticationTicket>
<tns:UploadHandler>a1b2c3d4-e5f6-7890-abcd-ef1234567890</tns:UploadHandler>
</tns:DeleteUploadHandler>
</soap:Body>
</soap:Envelope>
JavaScript¶
Every call answers XML with HTTP 200, success or not, so success is the thing to branch on and
errorCode is the number to report.
async function call(action, params) {
const response = await fetch(`/srv.asmx/${action}?${new URLSearchParams(params)}`);
const root = new DOMParser()
.parseFromString(await response.text(), 'text/xml')
.documentElement;
if (root.getAttribute('success') !== 'true') {
throw new Error(`${root.getAttribute('errorCode')}: ${root.getAttribute('error')}`);
}
return root;
}
Abandons an upload started with CreateUploadHandler and lets the server discard whatever was uploaded so far.
Deleting the same handler twice is a success, not a 4041 - the operation is safe to call in a
finally. A value that is not a GUID is refused 4000 before anything is looked up, with a message
that says so and arrives in the caller's language. It used to be the untranslated literal
bad Request.
Notes¶
-
If the handler's temporary file does not exist (e.g. already cleaned up or never fully written), the call still returns success -" no error is raised.
-
Passing a string that is not a valid GUID format returns an error immediately without performing any authentication check.
-
Do not call
DeleteUploadHandlerafter a successfulUploadDocumentWithHandler-" the handler is consumed by the finalization step and the temporary file is already removed. -
Call
DeleteUploadHandlerif an error occurs at any point duringUploadFileChunkor beforeUploadDocumentWithHandleris called, to free the temporary server storage.
Related APIs¶
-
CreateUploadHandler - Allocate an upload handler and obtain the GUID and chunk size
-
UploadFileChunk - Upload a single chunk of a file to an open handler
-
UploadDocumentWithHandler - Finalize the upload and create or update a document
-
DeleteDownloadHandler - Delete a download handler and discard its temporary file
Error Codes¶
The errorCode values this operation returns, checked against a running server:
errorCode |
When |
|---|---|
4010 |
the ticket is expired or unknown, or there is no ticket at all |
4000 |
UploadHandler is not a GUID |
| Error | Description |
|---|---|
[900] Authentication failed |
Invalid or missing authentication ticket. |
[901] Session expired or Invalid ticket |
The ticket has expired or does not exist. |
| The upload handler is not a handler. | UploadHandler is not a valid GUID string. |