联系客服 新闻资讯 所有频道 使用说明 芯片选型

Get own user

Get basic data about the user/bot that requests this endpoint.

GET https://we.comake.online/api/v1/users/me

Usage examples

#!/usr/bin/env python3

import zulip

# Pass the path to your zuliprc file here.
client = zulip.Client(config_file="~/zuliprc")

# Get the profile of the user/bot that requests this endpoint,
# which is `client` in this case:
result = client.get_profile()
print(result)

More examples and documentation can be found here.

const zulipInit = require("zulip-js");

// Pass the path to your zuliprc file here.
const config = { zuliprc: "zuliprc" };

(async () => {
    const client = await zulipInit(config);

    // Get the profile of the user/bot that requests this endpoint,
    // which is `client` in this case:
    console.log(await client.users.me.getProfile());
})();

curl -sSX GET -G https://we.comake.online/api/v1/users/me \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY

Parameters

This endpoint takes no parameters.

Response

Return values

  • avatar_url: string URL for the user's avatar.

    Changes: New in Zulip 2.1.0.

  • avatar_version: integer Version for the user's avatar. Used for cache-busting requests for the user's avatar. Clients generally shouldn't need to use this; most avatar URLs sent by Zulip will already end with ?v={avatar_version}.

    Changes: New in Zulip 3.0 (feature level 10). Previous versions do not return this field.

  • email: string Email of the requesting user.

  • full_name: string Full name of the requesting user.

  • is_admin: boolean A boolean indicating if the requesting user is an admin.

  • is_owner: boolean A boolean indicating if the requesting user is an organization owner.

    Changes: New in Zulip 3.0 (feature level 8).

  • role: integer Organization-level role) of the user. Poosible values are:

    • Organization owner => 100
    • Organization administrator => 200
    • Organization moderator => 300
    • Member => 400
    • Guest => 600

    Changes: New in Zulip 4.0 (feature level 59).

  • is_guest: boolean A boolean indicating if the requesting user is a guest.

    Changes: New in Zulip 3.0 (feature level 10). Previous versions do not return this field.

  • is_bot: boolean A boolean indicating if the requesting user is a bot.

  • is_active: boolean A boolean specifying whether the user account has been deactivated.

    Changes: New in Zulip 3.0 (feature level 10). Previous versions do not return this field.

  • timezone: string The time zone of the user.

    Changes: New in Zulip 3.0 (feature level 10). Previous versions do not return this field.

  • date_joined: string The time the user account was created.

    Changes: New in Zulip 3.0 (feature level 10). Previous versions do not return this field.

  • max_message_id: integer The integer ID of the last message received by your account.

    Deprecated. We plan to remove this in favor of recommending using GET /messages with anchor="newest".

  • user_id: integer The user's ID.

  • delivery_email: string The user's real email address. This field is present only if email address visibility is limited and you are an administrator with access to real email addresses under the configured policy.

  • profile_data: object A dictionary containing custom profile field data for the user. Each entry maps the integer ID of a custom profile field in the organization to a dictionary containing the user's data for that field. Generally the data includes just a single value key; for those custom profile fields supporting Markdown, a rendered_value key will also be present.

    • {id}: object Object with data about what value user filled in the custom profile field with id id.

      • value: string User's personal value for this custom profile field.

      • rendered_value: string The value rendered in HTML. Will only be present for custom profile field types that support Markdown rendering.

        This user-generated HTML content should be rendered using the same CSS and client-side security protections as are used for message content.

Example response

A typical successful JSON response may look like:

{
    "avatar_url": "https://secure.gravatar.com/avatar/af4f06322c177ef4e1e9b2c424986b54?d=identicon&version=1",
    "avatar_version": 1,
    "date_joined": "2019-10-20T07:50:53.728864+00:00",
    "email": "iago@zulip.com",
    "full_name": "Iago",
    "is_active": true,
    "is_admin": true,
    "is_bot": false,
    "is_guest": false,
    "is_owner": false,
    "max_message_id": 30,
    "msg": "",
    "profile_data": {
        "1": {
            "rendered_value": "<p>+1-234-567-8901</p>",
            "value": "+1-234-567-8901"
        },
        "2": {
            "rendered_value": "<p>Betrayer of Othello.</p>",
            "value": "Betrayer of Othello."
        },
        "3": {
            "rendered_value": "<p>Apples</p>",
            "value": "Apples"
        },
        "4": {
            "value": "emacs"
        },
        "5": {
            "value": "2000-01-01"
        },
        "6": {
            "value": "https://zulip.readthedocs.io/en/latest/"
        },
        "7": {
            "value": "[10]"
        },
        "8": {
            "value": "zulip"
        }
    },
    "result": "success",
    "role": 200,
    "timezone": "",
    "user_id": 5
}