[comment]: # translation:outdated

[comment]: # ({53d969c5-f9e8f670})
# userdirectory.get

[comment]: # ({/53d969c5-f9e8f670})

[comment]: # ({new-b5ff62ed})
### Description

`integer/array userdirectory.get(object parameters)`

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

::: noteclassic
This method is only available to *Super admin* user types.
:::

[comment]: # ({/new-b5ff62ed})

[comment]: # ({new-d99c84a0})
### Parameters

`(object)` Parameters defining the desired output.

The method supports the following parameters.

|Parameter|[Type](/manual/api/reference_commentary#data_types)|Description|
|---------|---------------------------------------------------|-----------|
|userdirectoryids       |string/array   |Return only user directory with the given IDs. |
|selectUsrgrps          |query          |Return a `usrgrps` property with [user groups](/manual/api/reference/usergroup/object) associated with user directory.<br><br>Supports `count`. |
|sortfield              |string/array   |Sort the result by the given properties.<br><br>Possible values are: `name`, `host`. |
|filter                 |object         |Return only those results that exactly match the given filter.<br><br>Possible values are: `userdirectoryid`, `host`, `name`.|
|search                 |object         |Return results that match the given wildcard search (case-insensitive).<br><br>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](/manual/api/reference_commentary#common_get_method_parameters).|
|excludeSearch          |boolean        |^|
|limit                  |integer        |^|
|output                 |query          |^|
|preservekeys           |boolean        |^|
|searchByAny            |boolean        |^|
|searchWildcardsEnabled |boolean        |^|
|sortorder              |string/array   |^|
|startSearch            |boolean        |^|

[comment]: # ({/new-d99c84a0})

[comment]: # ({7223bab1-a18ff82b})
### Valori restituiti

`(integer/array)` Restituisce o:

- una matrice di oggetti;
- il conteggio degli oggetti recuperati, se il parametro `countOutput` è
    stato usato. 

[comment]: # ({/7223bab1-a18ff82b})

[comment]: # ({b41637d2-ba1c8d4c})
### Esempi 

[comment]: # ({/b41637d2-ba1c8d4c})

[comment]: # ({new-6acef378})
#### Retrieving user directories

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

Request:

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

Response:

```json
{
    "jsonrpc": "2.0",
    "result": [
        {
            "userdirectoryid": "2",
            "name": "API user directory #1",
            "description": "",
            "host": "127.0.0.1",
            "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
}
```

[comment]: # ({/new-6acef378})

[comment]: # ({860ec55f-5f3bc200})
### Guarda anche

- [Gruppo utenti](/manual/api/reference/usergroup/object#user)

[comment]: # ({/860ec55f-5f3bc200})

[comment]: # ({901c82dd-392498dd})
### Fonte

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

[comment]: # ({/901c82dd-392498dd})
