Часть технических описаний пока доступна на английском языке.

Создать экспорт данных

Этот метод API доступен только администраторам организации.

POST https://z.u1v.ru/api/v1/export/realm

Note: If you're the administrator of a self-hosted installation, you may be looking for the documentation on server data export and import or server backups.

Create a public or a standard data export of the organization.

This endpoint only queues the data export; it does not wait for the export to complete, which depending on the size of the organization can take anywhere from seconds to an hour. Therefore, this endpoint's success response does not describe the outcome of the export.

To find out the outcome of the export, clients should rely on the realm_export event, which is which is sent to every organization administrator immediately when the export is requested, and again once it completes or fails. Additionally, when the export succeeds, the user who requested it will receive a direct message from the Notification Bot with a link to the organization's data exports panel, where the export can be downloaded.

Changes: Prior to Zulip 10.0 (feature level 304), only public data exports could be created using this endpoint.

New in Zulip 2.1.

Примеры запросов

#!/usr/bin/env python

import pero

# The user for this perorc file must be an organization administrator
client = pero.Client(config_file="~/.perorc-admin")

# Create a public data export of the organization.
result = client.call_endpoint(url="/export/realm", method="POST")
print(result)

Параметр -u задаёт учётные данные для HTTP-аутентификации Basic. Как получить их для пользователя или бота, описано в разделе о заголовке Authorization.

curl -sSX POST https://z.u1v.ru/api/v1/export/realm \
    -u EMAIL_ADDRESS:API_KEY \
    --data-urlencode export_type=full_with_consent

Параметры

export_type string необязательно

Пример: "full_with_consent"

Whether the data export should be public, full with consent, or full without consent.

  • public = Public data only export.
  • full_with_consent = Public and private data export (with consent), which includes private data for users who have granted consent.
  • full_without_consent = All public and private data export, which includes private data for all users. This option requires the organization to have the owner_full_content_access feature enabled.

If not specified, defaults to public.

Changes: Zulip 12.0 (feature level 449) changed the type of this field from int to string with 1 being replaced by public and 2 being replaced by full_with_consent. The option full_without_consent was added for full exports without member consent.

New in Zulip 10.0 (feature level 304). Previously, all export requests were public data exports.

Допустимые значения: "public", "full_with_consent", "full_without_consent". По умолчанию: "public".


Ответ

Возвращаемые поля

  • id: integer

    ID созданного экспорта данных.

    Изменения: Добавлено в Zulip 7.0 (feature level 182).

Примеры ответов

Изменения: Начиная с Zulip 7.0 (уровень возможностей 167), успешный JSON-ответ содержит массив ignored_parameters_unsupported, если запрос включает параметры, которые метод не поддерживает.

Пример успешного JSON-ответа:

{
    "id": 1,
    "msg": "",
    "result": "success"
}

Пример JSON-ответа с ошибкой, если экспорт данных превышает максимально допустимый размер.

{
    "code": "BAD_REQUEST",
    "msg": "Please request a manual export from zulip-admin@example.com.",
    "result": "error"
}