GetDownloadInfoByVersion API¶
Returns download metadata for a specific version of a document -" file size, MIME content type, modification date, suggested download file name, and CRC32 checksum -" without staging the file on the server or creating a download handler. This is the version-aware counterpart to GetDownloadInfo, which always queries the latest version.
To download the actual file content, use GetDownloadHandlerByVersion (chunked) or DownloadDocumentVersion (single call). To query the latest version without specifying a version number, use GetDownloadInfo.
Endpoint¶
Methods¶
-
GET
/srv.asmx/GetDownloadInfoByVersion?AuthenticationTicket=...&Path=...&VersionNumber=... -
POST
/srv.asmx/GetDownloadInfoByVersion(form data) -
SOAP Action:
http://tempuri.org/GetDownloadInfoByVersion
Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
AuthenticationTicket |
string | Yes | Authentication ticket obtained from AuthenticateUser. |
Path |
string | Yes | Full infoRouter path to the document (e.g. /Finance/Reports/Q1-Report.pdf), or a short document ID path (~D{id} or ~D{id}.ext). |
VersionNumber |
int | Yes | Internal version number of the version to query, as returned in the Number attribute of GetDocumentVersions (e.g. 1000000 for version 1, 2000000 for version 2). Values between 1 and 999,999 are invalid and will return an error. Pass 0 to query the latest version (equivalent to GetDownloadInfo). |
Version Number Format¶
infoRouter packs a major, a minor and a revision into one integer as
major * 1000000 + minor * 1000 + revision, so the number is not an ordinal:
| What it is | VersionNumber |
|---|---|
| Version 1.0.0, the first version of a document | 1000000 |
| Version 1.0.1, the second | 1000001 |
| Version 1.1.0 | 1001000 |
| Version 2.0.0 | 2000000 |
| The published version | 0 |
Read the numbers a document actually carries from GetDocumentVersions rather than computing them:
successive check-ins normally bump the revision, so the second version of a document is 1000001,
not 2000000.
Always use the Number attribute from GetDocumentVersions to obtain the correct value.
Response¶
Success Response¶
Returns file metadata for the specified version. No temporary file is created on the server and no handler GUID is issued.
<response success="true"
Size="102400"
ContentType="application/pdf"
ModificationDate="2024-03-10"
VersionNumber="1000000"
AlterDocumentName="Q1-Report.pdf"
RenderedContent="false"
CRC32="a3f1c29d" />
Response Attributes¶
| Attribute | Description |
|---|---|
success |
true if the metadata was retrieved successfully. |
Size |
Total file size of the specified version in bytes. |
ContentType |
MIME type of the document version (e.g. application/pdf). |
ModificationDate |
Modification date of the specified version in yyyy-MM-dd format. |
VersionNumber |
The internal version number that was queried, echoed from the request parameter. |
AlterDocumentName |
The file name to use when saving a downloaded copy on the client side. |
RenderedContent |
true if the file would be served as a server-rendered temporary representation; false if the original stored file would be served. |
CRC32 |
CRC32 checksum of the version file for integrity verification. Empty string when RenderedContent is true. |
Note: This response never contains
ChunkSizeordownloadhandlerattributes because no file is staged and no handler is created.
Error Response¶
Required Permissions¶
The calling user must have at least read access to the document. Offline (archived) documents cannot be queried and return an error.
Example¶
GET Request¶
GET /srv.asmx/GetDownloadInfoByVersion
?AuthenticationTicket=3f2504e0-4f89-11d3-9a0c-0305e82c3301
&Path=/Finance/Reports/Q1-Report.pdf
&VersionNumber=1000000
HTTP/1.1
POST Request¶
POST /srv.asmx/GetDownloadInfoByVersion HTTP/1.1
Content-Type: application/x-www-form-urlencoded
AuthenticationTicket=3f2504e0-4f89-11d3-9a0c-0305e82c3301
&Path=/Finance/Reports/Q1-Report.pdf
&VersionNumber=1000000
SOAP Request¶
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tns="http://tempuri.org/">
<soap:Body>
<tns:GetDownloadInfoByVersion>
<tns:AuthenticationTicket>3f2504e0-4f89-11d3-9a0c-0305e82c3301</tns:AuthenticationTicket>
<tns:Path>/Finance/Reports/Q1-Report.pdf</tns:Path>
<tns:VersionNumber>1000000</tns:VersionNumber>
</tns:GetDownloadInfoByVersion>
</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;
}
Describes one named version of a document, without transferring it.
const info = await call('GetDownloadInfoByVersion', {
authenticationTicket: ticket,
Path: '/Finance/Reports/Q1.pdf',
VersionNumber: 1000000 // 0 means the published version
});
Four operations, two decisions¶
| Published version | A named version | |
|---|---|---|
| Describe only | GetDownloadInfo | GetDownloadInfoByVersion |
| Describe and open a chunked read | GetDownloadHandler | GetDownloadHandlerByVersion |
All four answer the same attributes - Size, ContentType, ModificationDate, VersionNumber,
AlterDocumentName and CRC32 - and the two that open a read add ChunkSize and downloadhandler.
VersionNumber is echoed back exactly as it was asked for, so a 0 stays 0 rather than resolving
to the number of the published version.
Notes¶
-
This API is a metadata-only call. No file is read from disk, no temporary file is created, and no download handler GUID is issued.
-
VersionNumberis the packedmajor * 1000000 + minor * 1000 + revision, not an ordinal. Use theNumberattribute fromGetDocumentVersionsrather than computing it. Values between 1 and 999,999 are explicitly rejected and will return an error. -
Passing
VersionNumber=0queries the latest version, which is equivalent to callingGetDownloadInfo. -
Both full infoRouter paths and short document ID paths (
~D{id}or~D{id}.ext) are accepted for thePathparameter. -
Offline (archived) documents cannot be queried and will return an error.
-
When
RenderedContentistrue, theCRC32attribute will be an empty string.
Related APIs¶
-
GetDownloadInfo - Get download metadata for the latest version of a document
-
GetDocumentVersions - Get the version list to obtain valid VersionNumber values
-
GetDownloadHandlerByVersion - Stage a specific version and return a handler GUID for chunked download
-
DownloadDocumentVersion - Download a specific version as a raw byte array in a single call
-
GetDocument - Get the full metadata properties of a document
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 |
4041 |
no document at that path, or no version carries that number |
HTTP 400 |
a required string parameter was empty; refused by model binding, so there is no error document |
A call with no ticket signs in as the anonymous user, so a document in a library flagged as anonymous can be read without authenticating.
| Error | Description |
|---|---|
[900] Authentication failed |
Invalid or missing authentication ticket. |
[901] Session expired or Invalid ticket |
The ticket has expired or does not exist. |
| Document not found | The specified Path does not resolve to an existing document. |
| Invalid version number | VersionNumber is between 1 and 999,999 (not a valid internal version number). |
| Offline document error | The document is in an archived/offline library and cannot be queried. |
SystemError:... |
An unexpected server-side error occurred. |