Managing CTERA Portal Users > Fetching Active Directory Users into CTERA Portal
Fetching Active Directory Users into CTERA Portal
Active Directory users are fetched automatically upon their first login. The fetched users are periodically checked for any updates, and refreshed if needed.
Manually fetch new users or user groups from Active Directory into CTERA Portal, and to immediately update the details of specific existing users in CTERA Portal that were modified in Active Directory, without waiting for the next automatic refresh.
API
admin/api
URI
{BASE_URL}
HTTP Method
POST
Request Body
List of objects of class ADSearchResult, specifying the details of Active Directory users or groups.
Expected Response status
200 OK
Object Method
syncAD
Result
The users matching the specified ADSearchResult objects are fetched and updated.
Java Example
To fetch the Active Directory users whose details are specified in the ADSearchResult object stored in the file SyncUser.xml, use the following:
String params = toString(new FileInputStream(new File("SyncUser.xml")));
String res = invokeMethod(client, baseUrl, "syncAD", params);
Example contents for SyncUser.xml:
<list>
  <obj class="ADSearchResult">
    <att id="dn">
      <val>CN=Dave Oren,OU=ou1,DC=ctera,DC=com</val>
    </att>
    <att id="domain">
      <val>ctera.com</val>
    </att>
    <att id="name">
      <val>dave</val>
    </att>
    <att id="type">
      <val>user</val>
    </att>
  </obj>
</list>
Fetching and Syncing Active Directory Users and Groups
Fetch an LDAP user or group
API
admin/api
URI
Fetch a user: {BASE_URL}/?query=u
Fetch a group: {BASE_URL}/?query=g
HTTP Method
POST
Request Content-Type
application/xml
Request body
Fetch a user:
<obj>
  <att id="name">
    <val>searchAD</val>
  </att>
  <att id="param">
    <obj class="SearchADParams">
      <att id="mode">
        <val>users</val>
      </att>
      <att id="name">
        <val>user_name</val>
      </att>
      <att id="domain">
        <val>domain_name</val>
      </att>
    </obj>
  </att>
</obj>
Fetch a group:
<obj>
  <att id="name">
    <val>searchAD</val>
  </att>
  <att id="param">
    <obj class="SearchADParams">
      <att id="mode">
        <val>groups</val>
      </att>
      <att id="name">
        <val>group_name</val>
      </att>
      <att id="domain"/>
    </obj>
  </att>
</obj>
Response body
The user XML response:
<list>
  <obj class="ADSearchResult">
    <att id="dn">
      <val>uid=user.0,ou=People,o=sites,dc=ctera,dc=me</val>
    </att>
    <att id="domain"/>
    <att id="email"/>
    <att id="firstName"/>
    <att id="fullName">
      <val>full_name</val>
    </att>
    <att id="lastName"/>
    <att id="name">
      <val>user.0</val>
    </att>
    <att id="rid"/>
    <att id="type">
      <val>user</val>
    </att>
  </obj>
</list>
The user XML response:
<list>
  <obj class="ADSearchResult">
    <att id="dn">
      <val>cn=group.100,ou=People,o=sites,dc=ctera,dc=me</val>
    </att>
    <att id="domain"/>
    <att id="email"/>
    <att id="firstName"/>
    <att id="fullName">
      <val>full_name</val>
    </att>
    <att id="lastName"/>
    <att id="name">
      <val>cn=group.100,ou=People</val>
    </att>
    <att id="rid"/>
    <att id="type">
      <val>group</val>
    </att>
  </obj>
</list>
Expected Response status
200 OK
The request body:
mode – Mandatory: The LDAP mode. Valid values: users, groups.
name – A name to identify the user.
domain – The LDAP domain.
Sync the selected user
API
admin/api
URI
{BASE_URL}
HTTP Method
POST
Request Content-Type
application/xml
Request body
Sync a user:
<obj>
  <att id="name">
    <val>syncAD</val>
  </att>
  <att id="param">
    <list>
      <obj class="ADSearchResult">
        <att id="dn">
          <val>uid=user.0,ou=People,o=sites,dc=ctera,dc=me</val>
        </att>
        <att id="domain"/>
        <att id="email"/>
        <att id="firstName"/>
        <att id="fullName">
          <val>full_name</val>
        </att>
        <att id="lastName"/>
        <att id="name">
          <val>user.0</val>
        </att>
        <att id="rid"/>
        <att id="type">
          <val>user</val>
        </att>
      </obj>
    </list>
  </att>
</obj>
Sync a group:
<obj>
  <att id="name">
    <val>syncAD</val>
  </att>
  <att id="param">
    <list>
      <obj class="ADSearchResult">
        <att id="dn">
          <val>cn=group.100,ou=People,o=sites,dc=ctera,dc=me</val>
        </att>
        <att id="domain"/>
        <att id="email"/>
        <att id="firstName"/>
        <att id="fullName"/>
        <att id="lastName"/>
        <att id="name">
          <val>cn=group.100,ou=People</val>
        </att>
        <att id="rid"/>
        <att id="type">
          <val>group</val>
        </att>
      </obj>
    </list>
  </att>
</obj>
Expected Response status
200 OK
The request body:
dn – Mandatory: The domain name, consisting of the common name (cn), organization unit (ou), domain controller (dc).
domain – The LDAP domain.
email – The email address of the user, not used for a group.
firstName – The first name of the user, not used for a group.
fullName – The full name of the user, not used for a group.
lastName – The last name of the user, not used for a group.
name – Mandatory: The LDAP name of the user, consisting of the common name (cn), organization unit (ou).
rid – A relative identifier used by Microsoft Active Directory.
type – Mandatory: The type of user. Valid values: user, group.