2017-12-30 04:09:58 +01:00
|
|
|
# Get all users
|
|
|
|
|
2020-02-14 21:39:12 +01:00
|
|
|
Retrieve details on all users in the organization. Optionally
|
|
|
|
includes values of [custom profile field](/help/add-custom-profile-fields).
|
2017-12-30 04:09:58 +01:00
|
|
|
|
|
|
|
`GET {{ api_url }}/v1/users`
|
|
|
|
|
2020-02-14 21:39:12 +01:00
|
|
|
You can also [fetch details on a single user](/api/get-user).
|
|
|
|
|
2017-12-30 04:09:58 +01:00
|
|
|
## Usage examples
|
|
|
|
|
2018-09-17 16:27:32 +02:00
|
|
|
{start_tabs}
|
|
|
|
{tab|python}
|
2017-12-30 04:09:58 +01:00
|
|
|
|
2018-06-18 19:43:40 +02:00
|
|
|
{generate_code_example(python)|/users:get|example}
|
2017-12-30 04:09:58 +01:00
|
|
|
|
2018-09-17 16:27:32 +02:00
|
|
|
{tab|js}
|
2017-12-30 04:09:58 +01:00
|
|
|
|
|
|
|
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
|
|
|
```js
|
|
|
|
const zulip = require('zulip-js');
|
|
|
|
|
2019-01-07 14:27:58 +01:00
|
|
|
// Pass the path to your zuliprc file here.
|
2017-12-30 04:09:58 +01:00
|
|
|
const config = {
|
2019-01-07 14:27:58 +01:00
|
|
|
zuliprc: 'zuliprc',
|
2017-12-30 04:09:58 +01:00
|
|
|
};
|
|
|
|
|
2018-01-13 23:27:10 +01:00
|
|
|
zulip(config).then((client) => {
|
|
|
|
// Get all users in the realm
|
|
|
|
client.users.retrieve().then(console.log);
|
2017-12-30 04:09:58 +01:00
|
|
|
|
2018-01-13 23:27:10 +01:00
|
|
|
// You may pass the `client_gravatar` query parameter as follows:
|
|
|
|
client.users.retrieve({client_gravatar: true}).then(console.log);
|
2017-12-30 04:09:58 +01:00
|
|
|
});
|
|
|
|
```
|
|
|
|
|
2018-09-17 16:27:32 +02:00
|
|
|
{tab|curl}
|
|
|
|
|
2019-10-11 14:51:18 +02:00
|
|
|
{generate_code_example(curl, include=[""])|/users:get|example}
|
2018-09-17 16:27:32 +02:00
|
|
|
|
|
|
|
You may pass the `client_gravatar` query parameter as follows:
|
|
|
|
|
2019-10-11 14:51:18 +02:00
|
|
|
{generate_code_example(curl)|/users:get|example}
|
2017-12-30 04:09:58 +01:00
|
|
|
|
2018-09-17 16:27:32 +02:00
|
|
|
{end_tabs}
|
2017-12-30 04:09:58 +01:00
|
|
|
|
2018-01-20 22:03:05 +01:00
|
|
|
## Arguments
|
|
|
|
|
|
|
|
**Note**: The following arguments are all URL query parameters.
|
|
|
|
|
2018-06-18 19:43:40 +02:00
|
|
|
{generate_api_arguments_table|zulip.yaml|/users:get}
|
2018-01-20 22:03:05 +01:00
|
|
|
|
2017-12-30 04:09:58 +01:00
|
|
|
## Response
|
|
|
|
|
|
|
|
#### Return values
|
|
|
|
|
2020-03-08 21:13:11 +01:00
|
|
|
* `members`: A list of dictionaries, each containing the details for
|
|
|
|
one of the users in the organization.
|
|
|
|
* `email`: The email address of the user or bot.
|
2017-12-30 04:09:58 +01:00
|
|
|
* `is_bot`: A boolean specifying whether the user is a bot or not.
|
|
|
|
* `avatar_url`: URL to the user's gravatar. `None` if the `client_gravatar`
|
2020-03-28 01:25:56 +01:00
|
|
|
query parameter was set to `True`.
|
2017-12-30 04:09:58 +01:00
|
|
|
* `full_name`: Full name of the user or bot.
|
|
|
|
* `is_admin`: A boolean specifying whether the user is an admin or not.
|
|
|
|
* `bot_type`: `None` if the user isn't a bot. `1` for a `Generic` bot.
|
|
|
|
`2` for an `Incoming webhook` bot. `3` for an `Outgoing webhook` bot.
|
|
|
|
`4` for an `Embedded` bot.
|
|
|
|
* `user_id`: The ID of the user.
|
2020-04-19 00:29:31 +02:00
|
|
|
* `bot_owner_id`: If the user is a bot (i.e. `is_bot` is `True`), `bot_owner`
|
|
|
|
is the user ID of the bot's owner (usually, whoever created the bot).
|
|
|
|
**Changes**: New in Zulip 2.2. In previous versions, there was a `bot_owner`
|
|
|
|
field containing the email address of the bot's owner.
|
2017-12-30 04:09:58 +01:00
|
|
|
* `is_active`: A boolean specifying whether the user is active or not.
|
2019-01-23 07:41:29 +01:00
|
|
|
* `is_guest`: A boolean specifying whether the user is a guest user or not.
|
2019-04-03 21:35:53 +02:00
|
|
|
* `timezone`: The time zone of the user.
|
2017-12-30 04:09:58 +01:00
|
|
|
|
|
|
|
#### Example response
|
|
|
|
|
|
|
|
A typical successful JSON response may look like:
|
|
|
|
|
2018-06-18 19:43:40 +02:00
|
|
|
{generate_code_example|/users:get|fixture(200)}
|