This is the documentation page for an unsupported version of Zabbix.
Is this not what you were looking for? Switch to the current version or choose one from the drop-down menu.



integer/array userdirectory.get(object parameters)

The method allows to retrieve user directories according to the given parameters.

This method is only available to Super admin user types.


(object) Parameters defining the desired output.

The method supports the following parameters.

Parameter Type Description
userdirectoryids string/array Return only user directory with the given IDs.
selectUsrgrps query Return a usrgrps property with user groups associated with user directory.

Supports count.
sortfield string/array Sort the result by the given properties.

Possible values are: name, host.
filter object Return only those results that exactly match the given filter.

Possible values are: userdirectoryid, host, name.
search object Return results that match the given wildcard search (case-insensitive).

Possible values are: base_dn, bind_dn, description, host, name, search_attribute, search_filter.
countOutput boolean These parameters being common for all get methods are described in detail in the reference commentary.
excludeSearch boolean
limit integer
output query
preservekeys boolean
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch boolean

Return values

(integer/array) Returns either:

  • an array of objects;
  • the count of retrieved objects, if the countOutput parameter has been used.


Retrieving user directories

Retrieve all user directories with additional property with count of user groups where user directory is used.


           "jsonrpc": "2.0",
           "method": "userdirectory.get",
           "params": {
               "output": "extend",
               "selectUsrgrps": "count"
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1


           "jsonrpc": "2.0",
           "result": [
                   "userdirectoryid": "2",
                   "name": "API user directory #1",
                   "description": "",
                   "host": "",
                   "port": "389",
                   "base_dn": "ou=Users,dc=example,dc=org",
                   "bind_dn": "cn=ldap_search,dc=example,dc=org",
                   "search_attribute": "uid",
                   "start_tls": "0",
                   "search_filter": "",
                   "usrgrps": "5"
           "id": 1

See also


CUserDirectory::get() in ui/include/classes/api/services/CUserDirectory.php.