element-hq / element-hq/synapse

Dedicated admin API to create new users (and not update existing users)

Open
#8,165 0 comments 0 reactions 0 assignees View on GitHub
A-Admin-API T-Enhancement
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

This issue has been migrated from [#8165](https://github.com/matrix-org/synapse/issues/8165).

---

**Description:**

i have a little application which can create new users on homeservers. it talks to the homeserver through the admin rest api and therefore requires a valid admin user.
now i noticed that those PUT requests are not only creating but also updating existing users.

https://restfulapi.net/rest-put-vs-post/

> POST /device-management/devices : Create a new device

At the moment, only the second part is supported by matrix synapse:

> PUT /device-management/devices/{id} : Update the device information identified by "id"

https://github.com/matrix-org/synapse/blob/master/docs/admin_api/user_admin_api.rst#create-or-modify-account

So i have to check if the user already exists and then create it. Its just a small thing but i would really appreciate it, if there is some kind of:

```
POST /_synapse/admin/v2/users/
```

with a body like:
```
{user: "someNewUser", password: "someNewPassword"}
```
which returns an Error when the user which should be created already exists.

I guess that is very common in the web that an exception is thrown when a user already exists instead of (accidentally) updating the password... thats what happened to my little project. Lucky me it is only in testing yet :)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.