Support
 
Phone Live Chat
 
Support
 
US: +1 888 720 9500
US: +1 800 443 6694
Intl: +1 925 924 9500
Aus: +1 800 631 268
UK: 0800 028 6590
CN: +86 400 660 8680

Direct Inward Dialing: +1 408 916 9393

 
 
 
 
 
Search OU API
 

Search OU API

This API allows you to locate any OU in your Active Directory.

Request URL format: http://<hostname>:<port>/RestAPI/SearchOU

Request parameters:

Parameter name Mandatory Description
PRODUCT_NAME Yes Product name or module name from which the request is being sent; will be needed for auditing.
AuthToken Yes Authentication token that is generated either from the Delegation tab (Delegation > Configuration > Technician Authtokens) or from the My account tab (My Account > Active Authtokens) in the top right corner of the product.
domainName Yes Name of the domain in which the search is to be performed.
range Yes Number of OUs to be returned in the request's response.
startIndex Yes Starting index for the OU details result.
searchText No Text to be used in the search.
refresh No Boolean type. If true, the server will refresh and update the changes from AD to ADManager Plus, and then send the updated results.
sortColumn No Name of the column based on which the search result will be sorted. Any one of the columns in the search result can be used to sort the result.
ascending No Boolean type. If true, the search results are arranged in ascending order. If false, the results will be shown in descending order.

Note: By default, the results are in ascending order.

select No LDAP attributes that are to be displayed in the search result.
filter No LDAP attributes to refine the search.

Note: If you want to use filter to search, don't use searchText.

domainList No The domains in which the OU is to be searched for.

Response:

The response will be a JSON array string which contains the list of JSONObjects.

Parameter name Description
count Total number of OUs with the given search criteria.
OuLists JSONArray of the OU details. Each JSONObject in the array represents an OU in the search result. The JSONObject contains the key/value pair of attributes of the OU and their corresponding values.
statusMessage Contains the appropriate message if an issue or error occurs while processing the request.
status Status of the search operation. Displays SUCCESS on successful completion of the request.

Sample input/output:

Request

http://admanager:8080/RestAPI/SearchOU?domainName=test.com&AuthToken=3187f9d3-da6b-4bc2-aaff-a73495753b8d&range=2&startIndex=1&refresh=true&sortColumn=NAME&ascending=ascending&searchText=user

Response:

{
    "count": 15,
    "OuLists": [
        {
            "OU_NAME": "test.com",
            "DISTINGUISHED_NAME": "OU=Users,DC=test,DC=com",
            "CITY": "-",
            "COUNTRY": "-",
            "STATE_PROVINCE": "-",
            "OBJECT_GUID": "{F0D740EC-B741-46A8-A506-0AC71406FB7D}",
            "MANAGER": "-",
            "NAME": "Users"
        },
        {
            "OU_NAME": "test.com",
            "DISTINGUISHED_NAME": "OU=RealUser,DC=test,DC=com",
            "CITY": "-",
            "COUNTRY": "-",
            "STATE_PROVINCE": "-",
            "OBJECT_GUID": "{05A3BE59-F17D-4320-8F37-1A410F871247}",
            "MANAGER": "-",
            "NAME": "RealUser"
        }
    ],
    "statusMessage": "",
    "status": "SUCCESS"
}

Request with filter and select parameters

http://admanager:8080//RestAPI/SearchOU?domainName=test.com&AuthToken=0e0f9f3c-aec4-486a-9863-cf22ec6dfe99&range=4&startIndex=1&refresh=true&sortColumn=NAME&ascending=ascending&select=name,distinguishedName&filter=name:contains:Test-OU

Response:

{
    "count": 6,
    "OuLists": [
        {
            "DISTINGUISHED_NAME": "OU=Test-OU--1,DC=test,DC=com",
            "NAME": "Test-OU-1"
        },
        {
            "DISTINGUISHED_NAME": "OU=Test-OU--2,DC=test,DC=com",
            "NAME": "Test-OU-2"
        },
        {
            "DISTINGUISHED_NAME": "OU=Test-OU--3,DC=test,DC=com",
            "NAME": "Test-OU-3"
        },
        {
            "DISTINGUISHED_NAME": "OU=Test-OU--4,DC=test,DC=com",
            "NAME": "Test-OU--4"
        }
    ],
    "statusMessage": "",
    "status": "SUCCESS"
}
NOTE
  • The default admin account will not be considered as a help desk technician.
  • Ensure that you URL encode all the special and reserved characters used in REST API requests. Since the client sending the request (browser, postman, or TP tools) does not fall under ADManager Plus, encoding the URL for special, reserved, and unsafe characters is solely the users' responsibility.
  • Reserved characters include ; / ? : @ = &
    Unsafe characters include < > # % { } | \ ^ ~ [ ] ` "'
  • The filter parameter must be specified in the following format: (<LDAP/special key>:<operator>:<value> <logicalOperator> (<LDAP/special key>:<operator>:<value>.

    Example: (name:contains:Test1OU) wherein,

    • Special characters (,), and \ must be escaped with a backslash when given as a value. For instance, the value "Test\1(OU)" must be specified as (name:contains:Test\\1\(OU\)).
    • LDAP attributes and special keys are case-sensitive. Operators and logical operators, on the other hand, are case-insensitive.
    • The following special keys, operators, and logical operators can be used:
      • Operators: equal, equalCaseSensitive, notEqual, greaterThan, greaterEqual, lessThan, lessEqual , endsWith, notEndsWith, startsWith, notStartsWith, contains, notContains, like and notLike.
      • Logical operators: and and or.

ADManager Plus Trusted By

The one-stop solution to Active Directory Management and Reporting
Email Download Link