# X-Pack API - Updating user doesn't actually acknowledge update

**URL:** <https://discuss.elastic.co/t/x-pack-api-updating-user-doesnt-actually-acknowledge-update/82933>\
**Category:** Elasticsearch\
**Created:** [April 19, 2017, 5:40pm UTC](https://discuss.elastic.co/t/x-pack-api-updating-user-doesnt-actually-acknowledge-update/82933 "2017-04-19T17:40:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hartfordfive](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hartfordfive/32/44794_2.png) [@hartfordfive](https://discuss.elastic.co/u/hartfordfive)\
**Post date:** [April 19, 2017, 5:40pm UTC](https://discuss.elastic.co/t/x-pack-api-updating-user-doesnt-actually-acknowledge-update/82933/1 "2017-04-19T17:40:24Z")

</div>

I'm using the python elasticsearch pack library in order to automate user and role creation. Although the **_security.put\_user()_** and **_security.put\_role()_** methods do update the user/role if they already exists, the response returned is:

```
{'user': {'created': False}}

```

or

```
{'role': {'created': False}}

```

This doesn't really confirm the object was actually updated. I'm not sure if there could be a situation where the creation actually failed and returned this exact response, although It would be great if the response could acknowledge the update of an object. For example, return a response something like:

```
{'user': {'created': False, 'updated': True}}

```

would clearly indicate that the properties were successfully updated. If this seems like a reasonable modification to the X-Pack code base, I would be glad to open up a Github issue for this.

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [April 21, 2017, 1:17am UTC](https://discuss.elastic.co/t/x-pack-api-updating-user-doesnt-actually-acknowledge-update/82933/2 "2017-04-21T01:17:22Z")

</div>

We use HTTP status codes to indicate whether the request was successful or not, there is no need to indicate anything in the body of the response.

If the HTTP response was `200 OK` then the PUT was successful, otherwise it failed.  
If `created` is `true` then the user/role was created as part of the request, otherwise an existing user/role was updated.  
We do not indicate whether the PUT actually _changed_ the user/role (because we don't do diff'ing on the underlying objects).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 19, 2017, 1:23am UTC](https://discuss.elastic.co/t/x-pack-api-updating-user-doesnt-actually-acknowledge-update/82933/3 "2017-05-19T01:23:52Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
