IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Put User API
editPut User API
editExecution
editCreating and updating a user can be performed using the security().putUser()
method:
char[] password = new char[]{'p', 'a', 's', 's', 'w', 'o', 'r', 'd'}; PutUserRequest request = new PutUserRequest("example", password, Collections.singletonList("superuser"), null, null, true, null, RefreshPolicy.NONE); PutUserResponse response = client.security().putUser(request, RequestOptions.DEFAULT);
Response
editThe returned PutUserResponse
contains a single field, created
. This field
serves as an indication if a user was created or if an existing entry was updated.
Asynchronous Execution
editThis request can be executed asynchronously:
The asynchronous method does not block and returns immediately. Once the request
has completed the ActionListener
is called back using the onResponse
method
if the execution successfully completed or using the onFailure
method if
it failed.
A typical listener for a PutUserResponse
looks like: