Core
API v2.x
2

replaceUser #

Replaces a user with new configuration.


Query Syntax #

HTTP #

Copied to clipboard!
URL: http://kuzzle:7512/users/<_id>/_replace[?refresh=wait_for]
Method: PUT
Body:
Copied to clipboard!
{
  "profileIds": ["<profileId>"],
  // additional user properties (optional)
  "fullname": "John Doe"
}

Other protocols #

Copied to clipboard!
{
  "controller": "security",
  "action": "replaceUser",
  "_id": "<kuid>",
  "body": {
    "profileIds": ["<profileId>"],
    // additional user properties (optional)
    "fullname": "John Doe"
  }
}

Arguments #

Optional: #

  • refresh: if set to wait_for, Kuzzle will not respond until the user replacement is indexed (default: "wait_for")

Body properties #

  • profileIds: an array of security profiles attributed to the user

Optional: #

  • any other property: additional user information

Response #

Returns the user replacement status:

  • _id: new user kuid
  • _source: new user content and attributed profiles
Copied to clipboard!
{
  "status": 200,
  "error": null,
  "action": "replaceUser",
  "controller": "security",
  "requestId": "<unique request identifier>",
  "result": {
    "_id": "<kuid>",
    "_source": {
      "profileIds": ["<profileId>"],
      "fullname": "John Doe"
    }
  }
}