#!/usr/bin/env pythonimportpero# The user for this perorc file must be an organization administratorclient=pero.Client(config_file="~/.perorc-admin")# Create a custom profile field in the user's organization.request={"name":"Phone","hint":"Contact no.","field_type":1}result=client.call_endpoint(url="/realm/profile_fields",method="POST",request=request)print(result)
Параметр -u задаёт учётные данные для HTTP-аутентификации Basic.
Как получить их для пользователя или бота, описано в разделе
о заголовке Authorization.
The name of the custom profile field, which appears both in
the user-facing settings UI for configuring the custom profile
fields and in the UI displaying a user's profile.
Field types 3 (Dropdown) and 7 (External account) support storing
additional configuration for the field type in the field_data attribute.
For field type 3 (Dropdown), this attribute is a JSON object
defining the choices and the order they will be displayed in the
dropdown UI for individual users to select an option.
The interface for field type 7 is not yet stabilized.
Whether clients should display this profile field in the summary section of a
user's profile (or in a more easily accessible "small profile").
At most 2 profile fields may have this property be true in a given
organization.
The "Users" profile field is not supported, but that is likely to
be temporary.
Changes: Before Zulip 12.0 (feature level 476), the
"Paragraph" field type was not supported.
New in Zulip 6.0 (feature level 146).
requiredbooleanнеобязательно
Пример: true
Сделал ли администратор организации это поле профиля обязательным.
Обязательность поля можно изменить, поэтому клиентам нельзя предполагать, что обязательное дополнительное поле профиля всегда заполнено. Веб-приложение показывает заметный баннер пользователю, который не заполнил обязательное поле.
Изменения: Добавлено в Zulip 9.0 (уровень возможностей 244).
editable_by_userbooleanнеобязательно
Пример: true
Могут ли обычные пользователи редактировать это поле в собственном профиле.
Администраторы организации могут редактировать дополнительные поля профиля любого пользователя независимо от этой настройки.
Изменения: Добавлено в Zulip 10.0 (уровень возможностей 296).
use_for_user_matchingbooleanнеобязательно
Пример: false
Следует ли использовать это дополнительное поле профиля для поиска пользователей в подсказках автодополнения. Разрешено только для типов полей профиля «Короткий текст» и «Внешний аккаунт».
Поле включается в ответ только при значении true.
Изменения: Добавлено в Zulip 12.0 (уровень возможностей 455).
Ответ
Возвращаемые поля
id: integer
ID дополнительного поля профиля.
Примеры ответов
Изменения: Начиная с Zulip 7.0 (уровень возможностей 167), успешный JSON-ответ содержит массив ignored_parameters_unsupported, если запрос включает параметры, которые метод не поддерживает.