Skip to content

Commit 67b4ea1

Browse files
anoadragon453phil-flex
authored andcommitted
Clean up admin api docs (matrix-org#7361)
1 parent 2bb1dd4 commit 67b4ea1

2 files changed

Lines changed: 43 additions & 18 deletions

File tree

changelog.d/7361.doc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Clarify endpoint usage in the users admin api documentation.

docs/admin_api/user_admin_api.rst

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,22 @@ with a body of:
3333
3434
including an ``access_token`` of a server admin.
3535

36-
The parameter ``displayname`` is optional and defaults to ``user_id``.
37-
The parameter ``threepids`` is optional.
38-
The parameter ``avatar_url`` is optional.
39-
The parameter ``admin`` is optional and defaults to 'false'.
40-
The parameter ``deactivated`` is optional and defaults to 'false'.
41-
The parameter ``password`` is optional. If provided the user's password is updated and all devices are logged out.
36+
The parameter ``displayname`` is optional and defaults to the value of
37+
``user_id``.
38+
39+
The parameter ``threepids`` is optional and allows setting the third-party IDs
40+
(email, msisdn) belonging to a user.
41+
42+
The parameter ``avatar_url`` is optional. Must be a [MXC
43+
URI](https://matrix.org/docs/spec/client_server/r0.6.0#matrix-content-mxc-uris).
44+
45+
The parameter ``admin`` is optional and defaults to ``false``.
46+
47+
The parameter ``deactivated`` is optional and defaults to ``false``.
48+
49+
The parameter ``password`` is optional. If provided, the user's password is
50+
updated and all devices are logged out.
51+
4252
If the user already exists then optional parameters default to the current value.
4353

4454
List Accounts
@@ -51,16 +61,25 @@ The api is::
5161
GET /_synapse/admin/v2/users?from=0&limit=10&guests=false
5262

5363
including an ``access_token`` of a server admin.
54-
The parameters ``from`` and ``limit`` are required only for pagination.
55-
By default, a ``limit`` of 100 is used.
56-
The parameter ``user_id`` can be used to select only users with user ids that
57-
contain this value.
58-
The parameter ``guests=false`` can be used to exclude guest users,
59-
default is to include guest users.
60-
The parameter ``deactivated=true`` can be used to include deactivated users,
61-
default is to exclude deactivated users.
62-
If the endpoint does not return a ``next_token`` then there are no more users left.
63-
It returns a JSON body like the following:
64+
65+
The parameter ``from`` is optional but used for pagination, denoting the
66+
offset in the returned results. This should be treated as an opaque value and
67+
not explicitly set to anything other than the return value of ``next_token``
68+
from a previous call.
69+
70+
The parameter ``limit`` is optional but is used for pagination, denoting the
71+
maximum number of items to return in this call. Defaults to ``100``.
72+
73+
The parameter ``user_id`` is optional and filters to only users with user IDs
74+
that contain this value.
75+
76+
The parameter ``guests`` is optional and if ``false`` will **exclude** guest users.
77+
Defaults to ``true`` to include guest users.
78+
79+
The parameter ``deactivated`` is optional and if ``true`` will **include** deactivated users.
80+
Defaults to ``false`` to exclude deactivated users.
81+
82+
A JSON body is returned with the following shape:
6483

6584
.. code:: json
6685
@@ -73,7 +92,7 @@ It returns a JSON body like the following:
7392
"admin": 0,
7493
"user_type": null,
7594
"deactivated": 0,
76-
"displayname": <User One>,
95+
"displayname": "<User One>",
7796
"avatar_url": null
7897
}, {
7998
"name": "<user_id2>",
@@ -82,14 +101,19 @@ It returns a JSON body like the following:
82101
"admin": 1,
83102
"user_type": null,
84103
"deactivated": 0,
85-
"displayname": <User Two>,
104+
"displayname": "<User Two>",
86105
"avatar_url": "<avatar_url>"
87106
}
88107
],
89108
"next_token": "100",
90109
"total": 200
91110
}
92111
112+
To paginate, check for ``next_token`` and if present, call the endpoint again
113+
with ``from`` set to the value of ``next_token``. This will return a new page.
114+
115+
If the endpoint does not return a ``next_token`` then there are no more users
116+
to paginate through.
93117

94118
Query Account
95119
=============

0 commit comments

Comments
 (0)