Skip to content

GetDocumentTypes API

Returns the list of all document type definitions configured in the system. Document types allow documents to be classified and associated with a required custom property set.

Endpoint

/srv.asmx/GetDocumentTypes

Methods

  • GET /srv.asmx/GetDocumentTypes?AuthenticationTicket=...

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

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

Parameters

Parameter Type Required Description
AuthenticationTicket string Yes Authentication ticket obtained from AuthenticateUser.

Response

Success Response

Returns a <response> root element containing a <DocumentTypes> child with one <DocumentType> element per defined document type. If no document types are configured, <DocumentTypes> is present but empty.

<response success="true" error="">

  <DocumentTypes>

    <DocumentType TypeID="1"

                  TypeName="Contract"

                  PropertySetID="5"

                  PropertySetName="Contract Details"

                  Description="An agreement between two parties setting out terms" />

    <DocumentType TypeID="2"

                  TypeName="Invoice"

                  PropertySetID="8"

                  PropertySetName="Invoice Metadata"

                  Description="A supplier's request for payment" />

    <DocumentType TypeID="3"

                  TypeName="General"

                  PropertySetID="0"

                  PropertySetName=""

                  Description="" />

  </DocumentTypes>

</response>

DocumentType Element Attributes

Attribute Description
TypeID Unique integer ID of the document type.
TypeName Display name of the document type.
PropertySetID Integer ID of the custom property set associated with this document type. 0 if no property set is linked.
PropertySetName Name of the associated property set. Empty string if no property set is linked.

| Description | What the document type means, in a sentence. Empty string when no description has been set. |

No Document Types Response

When no document types are configured in the system:

<response success="true" error="">

  <DocumentTypes />

</response>

Error Response

<response success="false" error="[900] Authentication failed" />

Required Permissions

Any authenticated user may call this API.


Example

GET Request

GET /srv.asmx/GetDocumentTypes

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

HTTP/1.1

POST Request

POST /srv.asmx/GetDocumentTypes HTTP/1.1

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

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

SOAP Request

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

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

  <soap:Body>

    <tns:GetDocumentTypes>

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

    </tns:GetDocumentTypes>

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

Lists every document type and the property set each one requires.

const root = await call('GetDocumentTypes', { authenticationTicket: ticket });

for (const type of root.querySelectorAll('DocumentType')) {
  console.log(type.getAttribute('TypeID'),
              type.getAttribute('TypeName'),
              type.getAttribute('PropertySetName') || '(none)');
}

PropertySetID of 0 and an empty PropertySetName mean the type requires no property set. Reading the list needs no particular rights; creating and removing types does - see CreateDocumentTypeDef.

Notes

  • All document types defined in the system are returned; there is no filtering or pagination.

  • PropertySetID="0" and PropertySetName="" indicate the document type has no associated property set requirement.

  • Description is new in version 9. It is returned as an additional attribute, so a client written against an earlier response simply ignores it. Set it with CreateDocumentTypeDef1 or UpdateDocumentTypeDef1.

  • Description is what infoRouter tells infoRouter Connect the type is; a described type is recognised in a document noticeably better than one identified by its name alone.

  • To create, update, or delete document type definitions, use CreateDocumentTypeDef, UpdateDocumentTypeDef, or DeleteDocumentTypeDef.



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

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.
SystemError:... An unexpected server-side error occurred.