GetDomainMembershipsOfUser API¶
Returns a list of all domain/library memberships for the specified user. Shows every domain the user has access to as a member, sorted alphabetically by domain name.
Endpoint¶
Methods¶
- GET
/srv.asmx/GetDomainMembershipsOfUser?authenticationTicket=...&userName=... - POST
/srv.asmx/GetDomainMembershipsOfUser(form data) - SOAP Action:
http://tempuri.org/GetDomainMembershipsOfUser
Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
authenticationTicket |
string | Yes | Authentication ticket obtained from AuthenticateUser. |
userName |
string | Yes | Username of the user whose domain memberships to retrieve. |
Response¶
Success Response¶
Returns a <domains> collection with one <domain> element per membership.
<response success="true" error="">
<domains>
<domain DomainID="123" DomainName="Finance"
AnonymousDomain="FALSE" IsArchive="FALSE"
IsHidden="FALSE" WelcomeMessage="Welcome to the Finance Library" />
<domain DomainID="456" DomainName="HR"
AnonymousDomain="FALSE" IsArchive="FALSE"
IsHidden="FALSE" WelcomeMessage="" />
<domain DomainID="789" DomainName="Projects"
AnonymousDomain="FALSE" IsArchive="FALSE"
IsHidden="FALSE" WelcomeMessage="Active project documents" />
</domains>
</response>
If the user has no domain memberships, the <domains> element is empty:
Error Response¶
Domain Element Attributes¶
| Attribute | Description |
|---|---|
DomainID |
Unique numeric ID of the domain/library. |
DomainName |
Name of the domain/library. |
AnonymousDomain |
TRUE if the domain allows anonymous (guest) access, FALSE otherwise. |
IsArchive |
TRUE if the domain is archived (offline), FALSE if it is active. |
IsHidden |
TRUE if the domain is hidden from regular library listings, FALSE otherwise. |
WelcomeMessage |
The welcome/description message configured for the domain, or empty string if none. |
Required Permissions¶
Any authenticated user can call this API. A user can retrieve their own memberships as well as other users' memberships.
Example¶
GET Request¶
GET /srv.asmx/GetDomainMembershipsOfUser
?authenticationTicket=3f2504e0-4f89-11d3-9a0c-0305e82c3301
&userName=jdoe
HTTP/1.1
POST Request¶
POST /srv.asmx/GetDomainMembershipsOfUser HTTP/1.1
Content-Type: application/x-www-form-urlencoded
authenticationTicket=3f2504e0-4f89-11d3-9a0c-0305e82c3301
&userName=jdoe
SOAP Request¶
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tns="http://tempuri.org/">
<soap:Body>
<tns:GetDomainMembershipsOfUser>
<tns:authenticationTicket>3f2504e0-4f89-11d3-9a0c-0305e82c3301</tns:authenticationTicket>
<tns:userName>jdoe</tns:userName>
</tns:GetDomainMembershipsOfUser>
</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;
}
The libraries one user belongs to.
const root = await call('GetDomainMembershipsOfUser', { authenticationTicket: ticket, userName: 'jsmith' });
for (const domain of root.querySelectorAll('domain')) {
console.log(domain.getAttribute('DomainName'),
domain.getAttribute('DomainID'),
domain.getAttribute('AnonymousDomain'),
domain.getAttribute('IsArchive'));
}
Notes¶
- Results are sorted alphabetically by domain name.
- Includes both direct memberships and memberships acquired through user group membership.
- Archived (
IsArchive="TRUE") and hidden (IsHidden="TRUE") domains are included in the results. - The
WelcomeMessageattribute contains the domain's configured welcome/description text, which may be empty.
Related APIs¶
- GetDomains - Get the list of all domains in the system
- AddUserAsDomainMember - Add a user to a domain
- RemoveUserFromDomainMembership - Remove a user from a domain
- GetMemberDomains - Get the current user's member domains
Error Codes¶
The errorCode values this operation returns, checked against a running server:
errorCode |
When |
|---|---|
4041 |
no user by that name |
4010 |
the ticket is expired or unknown, or there is no ticket at all |
HTTP 400 |
a required string parameter was empty; refused by model binding, so there is no error document |