Skip to content

GetVersionTextOnlyContent API

Returns the plain-text alternative content stored alongside a specific version of a document. This text-only content is a separately stored artifact in the document warehouse -" it is only present if it has been explicitly set (for example, by a conversion process or via SetVersionTextOnlyContent). Passing 0 for the version number retrieves the latest version's content, equivalent to calling GetDocumentTextOnlyContent.

Endpoint

/srv.asmx/GetVersionTextOnlyContent

Methods

  • GET /srv.asmx/GetVersionTextOnlyContent?AuthenticationTicket=...&Path=...&VersionNumber=...

  • POST /srv.asmx/GetVersionTextOnlyContent (form data)

  • SOAP Action: http://tempuri.org/GetVersionTextOnlyContent

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 whose text-only content to retrieve. Pass 0 to retrieve the latest version. See note below for the internal version number format.

Internal version number format: infoRouter packs a major, a minor and a revision into one integer as major * 1000000 + minor * 1000 + revision. The first version of a document is 1000000 and the second is 1000001; 2000000 is major version 2, not the second version. Values between 1 and 999,999 are rejected. Use GetDocumentVersions to read the numbers a document actually has rather than computing them.

User-visible version VersionNumber value
1 1000000
2 2000000
3 3000000
Latest (any) 0

Response

Success Response

On success, the plain text content is returned as the body of the <response> element (not inside a child element):

<response success="true" error="">This is the plain text content of version 2000000 of the document.

It may span multiple lines and represents the text-only

alternative stored in the document warehouse for that version.</response>
Attribute Description
success "true" on success.
error Empty string on success.
(element body) The plain text content of the specified version. May be an empty string if text-only content has never been set for this version.

Error Response

<response success="false" error="There is no published version for this document." />

Required Permissions

The calling user must have at least read access to the document and the specified version.


Example

GET Request -" specific version

GET /srv.asmx/GetVersionTextOnlyContent

  ?AuthenticationTicket=3f2504e0-4f89-11d3-9a0c-0305e82c3301

  &Path=/Finance/Reports/Q1-2024-Report.pdf

  &VersionNumber=2000000

HTTP/1.1

GET Request -" latest version (VersionNumber=0)

GET /srv.asmx/GetVersionTextOnlyContent

  ?AuthenticationTicket=3f2504e0-4f89-11d3-9a0c-0305e82c3301

  &Path=/Finance/Reports/Q1-2024-Report.pdf

  &VersionNumber=0

HTTP/1.1

POST Request

POST /srv.asmx/GetVersionTextOnlyContent HTTP/1.1

Content-Type: application/x-www-form-urlencoded

AuthenticationTicket=3f2504e0-4f89-11d3-9a0c-0305e82c3301

&Path=/Finance/Reports/Q1-2024-Report.pdf

&VersionNumber=2000000

SOAP Request

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"

               xmlns:tns="http://tempuri.org/">

  <soap:Body>

    <tns:GetVersionTextOnlyContent>

      <tns:AuthenticationTicket>3f2504e0-4f89-11d3-9a0c-0305e82c3301</tns:AuthenticationTicket>

      <tns:Path>/Finance/Reports/Q1-2024-Report.pdf</tns:Path>

      <tns:VersionNumber>2000000</tns:VersionNumber>

    </tns:GetVersionTextOnlyContent>

  </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;
}

Reads the plain-text rendition stored against one version of a document.

const root = await call('GetVersionTextOnlyContent', {
  authenticationTicket: ticket,
  Path: '/Finance/Reports/Q1.pdf',
  VersionNumber: 0            // 0 means the published version
});

const text = root.textContent;    // on the root itself, not in a child element

Same content as GetDocumentTextOnlyContent, which always reads the published version; this one can read any of them. A version with nothing stored is a success with an empty root.

Notes

  • The text content is returned directly as the body of the <response> element, not inside a named child element.

  • This API retrieves a separately stored plain-text artifact from the document warehouse. It is distinct from the full-text search index abstract returned by GetDocumentAbstract1. The content is only present if it was previously written (e.g. by a document conversion process or via SetVersionTextOnlyContent).

  • Passing VersionNumber=0 retrieves the latest version's text-only content, equivalent to calling GetDocumentTextOnlyContent.

  • Version numbers in the range 1 to 999999 are invalid and will return an error. Version numbers must be exact multiples of 1000000.

  • Use GetDocumentVersions to enumerate all versions and their internal version numbers before calling this API.

  • Offline documents, URL documents, and shortcut documents do not have text-only content and will return an error.

  • Both full infoRouter paths and short document ID paths (~D{id} or ~D{id}.ext) are accepted for the Path parameter.



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 999999 (not a valid internal version number).
No published version The document has no published version.
Document is offline The document is marked as offline and its content is unavailable.
URL or shortcut URL documents and shortcuts do not have text-only content.
Access denied The user does not have read access to the document or the specified version.
SystemError:... An unexpected server-side error occurred.