2018-08-18 02:17:33 -04:00
|
|
|
[role="xpack"]
|
|
|
|
[[security-api-get-user]]
|
|
|
|
=== Get users API
|
2018-12-20 13:23:28 -05:00
|
|
|
++++
|
|
|
|
<titleabbrev>Get users</titleabbrev>
|
|
|
|
++++
|
2018-08-18 02:17:33 -04:00
|
|
|
|
|
|
|
Retrieves information about users in the native realm.
|
|
|
|
|
|
|
|
|
|
|
|
==== Request
|
|
|
|
|
2018-12-11 04:13:10 -05:00
|
|
|
`GET /_security/user` +
|
2018-08-18 02:17:33 -04:00
|
|
|
|
2018-12-11 04:13:10 -05:00
|
|
|
`GET /_security/user/<username>`
|
2018-08-18 02:17:33 -04:00
|
|
|
|
|
|
|
==== Description
|
|
|
|
|
|
|
|
For more information about the native realm, see
|
|
|
|
{stack-ov}/realms.html[Realms] and <<configuring-native-realm>>.
|
|
|
|
|
|
|
|
==== Path Parameters
|
|
|
|
|
|
|
|
`username`::
|
|
|
|
(string) An identifier for the user. You can specify multiple usernames as a comma-separated list. If you omit this parameter, the API retrieves
|
|
|
|
information about all users.
|
|
|
|
|
|
|
|
//==== Request Body
|
|
|
|
|
|
|
|
==== Authorization
|
|
|
|
|
|
|
|
To use this API, you must have at least the `manage_security` cluster privilege.
|
|
|
|
|
|
|
|
|
|
|
|
==== Examples
|
|
|
|
|
2018-12-11 04:13:10 -05:00
|
|
|
To retrieve a native user, submit a GET request to the `/_security/user/<username>`
|
2018-08-18 02:17:33 -04:00
|
|
|
endpoint:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
2018-12-11 04:13:10 -05:00
|
|
|
GET /_security/user/jacknich
|
2018-08-18 02:17:33 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
|
|
|
// TEST[setup:jacknich_user]
|
|
|
|
|
|
|
|
A successful call returns an array of users with the JSON representation of the
|
|
|
|
user. Note that user passwords are not included.
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"jacknich": {
|
|
|
|
"username": "jacknich",
|
|
|
|
"roles": [
|
|
|
|
"admin", "other_role1"
|
|
|
|
],
|
|
|
|
"full_name": "Jack Nicholson",
|
|
|
|
"email": "jacknich@example.com",
|
|
|
|
"metadata": { "intelligence" : 7 },
|
|
|
|
"enabled": true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
|
|
|
// TESTRESPONSE
|
|
|
|
|
|
|
|
If the user is not defined in the `native` realm, the request 404s.
|
|
|
|
|
|
|
|
Omit the username to retrieve all users:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
2018-12-11 04:13:10 -05:00
|
|
|
GET /_security/user
|
2018-08-18 02:17:33 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
|
|
|
// TEST[continued]
|