DeleteDownloadHandler API¶
Deletes a download handler and discards its associated temporary file on the server. Use this to clean up after a chunked download is complete or if the download session is cancelled before all chunks are retrieved.
Endpoint¶
Methods¶
-
GET
/srv.asmx/DeleteDownloadHandler?authenticationTicket=...&DownloadHandler=... -
POST
/srv.asmx/DeleteDownloadHandler(form data) -
SOAP Action:
http://tempuri.org/DeleteDownloadHandler
Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
authenticationTicket |
string | Yes | Authentication ticket obtained from AuthenticateUser. |
DownloadHandler |
string (GUID) | Yes | The handler GUID returned by GetDownloadHandler, GetDownloadHandlerByVersion, or DownloadZipWithHandler. Must be a valid GUID string. |
Response¶
Success Response¶
Error Response¶
Required Permissions¶
Any authenticated user may call this API. The handler is resolved by GUID -" only the handler file path associated with the current user's session is deleted.
Chunked Download Workflow¶
Download handlers are used in chunked download scenarios to stage large files server-side before the client retrieves them in pieces:
-
GetDownloadHandler(orGetDownloadHandlerByVersion/DownloadZipWithHandler) -" Prepare the file and obtain a handler GUID. -
DownloadFileChunk-" Download the file content in sequential chunks using the handler GUID. -
DeleteDownloadHandler-" Clean up the handler and its temporary file once all chunks are downloaded or if the download is abandoned.
Example¶
GET Request¶
GET /srv.asmx/DeleteDownloadHandler
?authenticationTicket=3f2504e0-4f89-11d3-9a0c-0305e82c3301
&DownloadHandler=a1b2c3d4-e5f6-7890-abcd-ef1234567890
HTTP/1.1
POST Request¶
POST /srv.asmx/DeleteDownloadHandler HTTP/1.1
Content-Type: application/x-www-form-urlencoded
authenticationTicket=3f2504e0-4f89-11d3-9a0c-0305e82c3301
&DownloadHandler=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:DeleteDownloadHandler>
<tns:authenticationTicket>3f2504e0-4f89-11d3-9a0c-0305e82c3301</tns:authenticationTicket>
<tns:DownloadHandler>a1b2c3d4-e5f6-7890-abcd-ef1234567890</tns:DownloadHandler>
</tns:DeleteDownloadHandler>
</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;
}
Ends a download and lets the server discard the staged archive.
try {
// ... read chunks ...
} finally {
await call('DeleteDownloadHandler', {
authenticationTicket: ticket,
DownloadHandler: handler
});
}
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.
Reading a chunk after the handler is deleted is 4000, the same as for a handler that never existed.
Notes¶
-
If the handler's temporary file does not exist (e.g. already cleaned up), 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.
-
Always call
DeleteDownloadHandlerafter finishing a chunked download to free temporary server storage, even if the download was not fully completed.
Related APIs¶
-
GetDownloadHandler - Prepare a document for chunked download and obtain a handler GUID
-
GetDownloadHandlerByVersion - Prepare a specific document version for chunked download
-
DownloadZipWithHandler - Prepare a zip archive of folders and documents for chunked download
-
DownloadFileChunk - Download a chunk of a file using a handler
-
DeleteUploadHandler - Delete an upload handler and discard its staged data
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 |
DownloadHandler 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 download handler is not a handler. | DownloadHandler is not a valid GUID string. |