Skip to content

GetDomainStatistics API

Returns statistics for the specified domain/library.

Endpoint

/srv.asmx/GetDomainStatistics

Methods

  • GET /srv.asmx/GetDomainStatistics?authenticationTicket=...&domainName=...
  • POST /srv.asmx/GetDomainStatistics (form data)
  • SOAP Action: http://tempuri.org/GetDomainStatistics

Parameters

Parameter Type Required Description
authenticationTicket string Yes Authentication ticket obtained from AuthenticateUser
domainName string Yes Name of the domain/library to get statistics for

Response

Success Response

<root success="true">
  <LibraryStatistics>
    <DomainId>123</DomainId>
    <DomainName>Finance</DomainName>
    <FolderCount>78</FolderCount>
    <LocalUserCount>25</LocalUserCount>
    <LocalGroupCount>5</LocalGroupCount>
    <DocumentCount>1234</DocumentCount>
    <CheckedOutCount>56</CheckedOutCount>
    <MemberUserCount>100</MemberUserCount>
    <MemberGroupCount>10</MemberGroupCount>
    <WorkflowDefinitionCount>3</WorkflowDefinitionCount>
    <TotalDocumentSize>1073741824</TotalDocumentSize>
  </LibraryStatistics>
</root>

LibraryStatistics Properties

Property Type Description
DomainId integer The id of the domain the numbers are of. Added in 9.0.
DomainName string Its name. Added in 9.0.
FolderCount integer Total number of folders in the domain
LocalUserCount integer Number of users created locally in this domain
LocalGroupCount integer Number of user groups created locally in this domain
DocumentCount integer Total number of documents in the domain
CheckedOutCount integer Number of documents currently checked out
MemberUserCount integer Number of users who are members of this domain
MemberGroupCount integer Number of user groups who are members of this domain
WorkflowDefinitionCount integer Number of workflow definitions in this domain
TotalDocumentSize long Total size of all documents in bytes

Error Response

<root success="false" error="[ErrorCode] Error message" />

Required Permissions

The caller must be an authenticated user. Anonymous users cannot access this API.

Example

Request (GET)

GET /srv.asmx/GetDomainStatistics?authenticationTicket=abc123-def456&domainName=MyLibrary HTTP/1.1
Host: server.example.com

Request (POST)

POST /srv.asmx/GetDomainStatistics HTTP/1.1
Content-Type: application/x-www-form-urlencoded

authenticationTicket=abc123-def456&domainName=MyLibrary

Request (SOAP 1.1)

POST /srv.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://tempuri.org/GetDomainStatistics"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetDomainStatistics xmlns="http://tempuri.org/">
      <authenticationTicket>abc123-def456</authenticationTicket>
      <domainName>MyLibrary</domainName>
    </GetDomainStatistics>
  </soap:Body>
</soap:Envelope>

Response Example

<root success="true"
      documentCount="5432"
      checkedOutCount="12"
      folderCount="234"
      totalDocumentSize="2147483648"
      localUserCount="50"
      localGroupCount="8"
      memberUserCount="150"
      memberGroupCount="15"
      workflowDefinitionCount="5" />

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

Counts what is in a library.

const root = await call('GetDomainStatistics', {
  authenticationTicket: ticket, domainName: 'Finance'
});

const statistics = root.querySelector('LibraryStatistics');
console.log(statistics.querySelector('DocumentCount').textContent,
            statistics.querySelector('TotalDocumentSize').textContent);

Everything is a child element rather than an attribute: FolderCount, LocalUserCount, LocalGroupCount, DocumentCount, CheckedOutCount, MemberUserCount, MemberGroupCount, WorkflowDefinitionCount and TotalDocumentSize.

A library nobody has been added to still reports MemberUserCount of 1 - its creator.

Notes

  • The totalDocumentSize is returned in bytes. To convert to human-readable format:
  • Divide by 1024 for KB
  • Divide by 1048576 for MB
  • Divide by 1073741824 for GB
  • localUserCount and localGroupCount refer to users/groups created within this domain
  • memberUserCount and memberGroupCount include both local and global members assigned to this domain
  • Statistics are calculated in real-time and may take longer for domains with large amounts of content

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 library by that name - including one the caller cannot see
HTTP 400 a required string parameter was empty; refused by model binding, so there is no error document