Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Add a new admin API to create a new device for a user #15611

Merged
merged 4 commits into from
May 17, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Document the new admin API
sandhose committed May 17, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit d4f7fe25b81877846514cf9a5829cd2c483f5ed1
26 changes: 26 additions & 0 deletions docs/admin_api/user_admin_api.md
Original file line number Diff line number Diff line change
@@ -813,6 +813,32 @@ The following fields are returned in the JSON response body:

- `total` - Total number of user's devices.

### Create a device

Creates a new device for a specific `user_id`.

The API is:

```
POST /_synapse/admin/v2/users/<user_id>/devices
{
"device_id": "QBUAZIFURK"
}
```

An empty JSON dict is returned.

**Parameters**

The following parameters should be set in the URL:

- `user_id` - fully qualified: for example, `@user:server.com`.

The following fields are required in the JSON request body:

- `device_id` - The device ID to create.

### Delete multiple devices
Deletes the given devices for a specific `user_id`, and invalidates
any access token associated with them.
1 change: 1 addition & 0 deletions synapse/rest/admin/devices.py
Original file line number Diff line number Diff line change
@@ -140,6 +140,7 @@ async def on_GET(
async def on_POST(
self, request: SynapseRequest, user_id: str
) -> Tuple[int, JsonDict]:
"""Creates a new device for the user."""
await assert_requester_is_admin(self.auth, request)

target_user = UserID.from_string(user_id)