SDK
SDK Java v2.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

replaceUser #

Replaces an existing user.


replaceUser(id, content, [options], [callback]) #

ArgumentsTypeDescription
idstringUnique user identifier
contentJSON ObjectA plain JSON object representing the user, should contain the mandatory profileIds field
optionsstring(Optional) Optional arguments
callbackfunction(Optional) Callback handling the response

Options #

FilterTypeDescriptionDefault
queuablebooleanMake this request queuable or nottrue
refreshstringIf set to wait_for, Kuzzle will wait for the persistence layer to finish indexing (available with Elasticsearch 5.x and above)undefined

Return Value #

Returns the Security object to allow chaining.


Callback Response #

Returns a User object.

Usage #

JSONObject newContent = new JSONObject()
  .put("profileIds", new JSONArray()
    .put("admin")
  )
  .put("firstname", "My Name Is")
  .put("lastname", "Jonas");
kuzzle
  .security
  .replaceUser("User ID", newContent, new ResponseListener<User>() {
    @Override
    public void onSuccess(User user) {
    }
    @Override
    public void onError(JSONObject error) {
    }
  });