For custom profile fields with type 7 (External account) that use
one of Zulip's configured default external account providers
(e.g., GitHub, LinkedIn, etc.), the field's
name,
hint, and
field_data
cannot be changed, and attempting to do so will return an error.
Changes: Before Zulip 9.0 (feature level 252), the name,
hint, field_data, required and display_in_profile_summary
parameters were all required in every request, even when their
values were unchanged.
Примеры запросов
Python
curl
#!/usr/bin/env pythonimportpero# The user for this perorc file must be an organization administratorclient=pero.Client(config_file="~/.perorc-admin")# Update a custom profile field in the user's organization.request={"name":"Cell","hint":"Contact number."}result=client.call_endpoint(url=f"/realm/profile_fields/{field_id}",method="PATCH",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.
hintstringнеобязательно
Пример: "Your favorite programming language."
Подсказка для дополнительного поля профиля, отображаемая в интерфейсе настроек таких полей.
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).
Ответ
Примеры ответов
Изменения: Начиная с Zulip 7.0 (уровень возможностей 167), успешный JSON-ответ содержит массив ignored_parameters_unsupported, если запрос включает параметры, которые метод не поддерживает.
Пример успешного JSON-ответа:
{"msg":"","result":"success"}
A typical failed JSON response for when there is no custom profile
field with the requested ID:
{"code":"BAD_REQUEST","msg":"Field id 4 not found.","result":"error"}
A typical failed JSON response for when another custom profile field
already uses the requested name:
{"code":"BAD_REQUEST","msg":"A field with that label already exists.","result":"error"}
A typical failed JSON response for when setting
display_in_profile_summary to true would exceed the
organization's limit of 2 such fields:
{"code":"BAD_REQUEST","msg":"Only 2 custom profile fields can be displayed in the profile summary.","result":"error"}
A typical failed JSON response for when attempting to change the
name, hint, or field_data of a default external account field:
{"code":"BAD_REQUEST","msg":"Default custom field cannot be updated.","result":"error"}