Get all users
Retrieve all users in a realm.
GET https://ch.uniauc.com/api/v1/users
Usage examples
#!/usr/bin/env python3
import zulip
# Pass the path to your zuliprc file here.
client = zulip.Client(config_file="~/zuliprc")
# Get all users in the realm
result = client.get_members()
print(result)
# You may pass the `client_gravatar` query parameter as follows:
result = client.get_members({'client_gravatar': True})
print(result)
# You may pass the `include_custom_profile_fields` query parameter as follows:
result = client.get_members({'include_custom_profile_fields': True})
print(result)
More examples and documentation can be found here.
const zulip = require('zulip-js');
// Pass the path to your zuliprc file here.
const config = {
zuliprc: 'zuliprc',
};
zulip(config).then((client) => {
// Get all users in the realm
client.users.retrieve().then(console.log);
// You may pass the `client_gravatar` query parameter as follows:
client.users.retrieve({client_gravatar: true}).then(console.log);
});
curl -sSX GET -G https://ch.uniauc.com/api/v1/users \
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
You may pass the client_gravatar
query parameter as follows:
curl -sSX GET -G https://ch.uniauc.com/api/v1/users \
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
-d 'client_gravatar=true' \
-d 'include_custom_profile_fields=true'
Arguments
Note: The following arguments are all URL query parameters.
Argument |
Example |
Required |
Description |
client_gravatar |
true |
No |
The client_gravatar field is set to true if clients can compute their own gravatars.
Defaults to false . |
include_custom_profile_fields |
true |
No |
Set to true if the client wants custom profile field data to be included in the response.
Defaults to false . |
Response
Return values
members
: A list of dictionaries where each dictionary contains information
about a particular user or bot.
email
: The email address of the user or bot..
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
query paramater was set to True
.
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.
bot_owner
: If the user is a bot (i.e. is_bot
is True
), bot_owner
is the email address of the user who created the bot.
is_active
: A boolean specifying whether the user is active or not.
is_guest
: A boolean specifying whether the user is a guest user or not.
timezone
: The time zone of the user.
Example response
A typical successful JSON response may look like:
{
"members": [
{
"avatar_url": "https://secure.gravatar.com/avatar/818c212b9f8830dfef491b3f7da99a14?d=identicon&version=1",
"bot_type": null,
"date_joined": "2019-10-20T07:50:53.728864+00:00",
"email": "AARON@zulip.com",
"full_name": "aaron",
"is_active": true,
"is_admin": false,
"is_bot": false,
"is_guest": false,
"profile_data": {},
"timezone": "",
"user_id": 7
},
{
"avatar_url": "https://secure.gravatar.com/avatar/6d8cad0fd00256e7b40691d27ddfd466?d=identicon&version=1",
"bot_type": null,
"date_joined": "2019-10-20T07:50:53.729659+00:00",
"email": "hamlet@zulip.com",
"full_name": "King Hamlet",
"is_active": true,
"is_admin": false,
"is_bot": false,
"is_guest": false,
"profile_data": {
"1": {
"rendered_value": "<p>+0-11-23-456-7890</p>",
"value": "+0-11-23-456-7890"
},
"2": {
"rendered_value": "<p>I am:</p>\n<ul>\n<li>The prince of Denmark</li>\n<li>Nephew to the usurping Claudius</li>\n</ul>",
"value": "I am:\n* The prince of Denmark\n* Nephew to the usurping Claudius"
},
"3": {
"rendered_value": "<p>Dark chocolate</p>",
"value": "Dark chocolate"
},
"4": {
"value": "vim"
},
"5": {
"value": "1900-1-1"
},
"6": {
"value": "https://blog.zulig.org"
},
"7": {
"value": "[11]"
},
"8": {
"value": "zulipbot"
}
},
"timezone": "",
"user_id": 10
},
{
"avatar_url": "https://secure.gravatar.com/avatar/7328586831cdbb1627649bd857b1ee8c?d=identicon&version=1",
"bot_owner_id": 11,
"bot_type": 1,
"date_joined": "2019-10-20T12:52:17.862053+00:00",
"email": "iago-bot@zulipdev.com",
"full_name": "Iago's Bot",
"is_active": true,
"is_admin": false,
"is_bot": true,
"is_guest": false,
"timezone": "",
"user_id": 23
}
],
"msg": "",
"result": "success"
}