Export room to a file or email.
{% hint style="info" %}
This requires the user to have the mail-messages
permission.
{% endhint %}
HTTP Method | URL | Requires Auth |
---|---|---|
POST | /api/v1/rooms.export | yes |
Key | Example Value | Description |
---|---|---|
rid * | JZ8Y2dLfYhsg323Rf | The room ID. |
type * | email | How you want the room to be exported. The type of export selected determines the remaining required parameters. It can be either email or file |
dateFrom | 2020-01-13 | Start date to begin fetching. Use dateFrom if the type is file . By default, it selects the oldest possible date. |
dateTo | 2021-12-13 | End date for fetching. By default it selects the current date. Use dateTo if the type is file . |
format * | html | The file type to export as. It can either be html or json . Use format if the type is file . |
toUsers * | ["test.user"] | An array of users that should recieve the export. It is required if type is email . |
toEmails * | ["test@test.com"] | An array of any additional emails that should recieve the export. It is required if type is email . |
messages * |
| An array of messageId for the messages that should be exported. It is required if type is email . |
subject * | Test Export | The subject of the email. It is required if type is email . |
curl -L -X POST 'http://localhost:3000/api/v1/rooms.export' \
-H 'X-User-Id: d26x6zSkaPSe5gCyy' \
-H 'X-Auth-Token: Zu-Z6eKzIIz7MCCRGeHi29bYkXZCJ4SxFC0JAasqm92' \
-H 'Content-Type: application/json' \
--data-raw '{
"rid": "iu7jtPAhvEeAS5tNq",
"type": "file",
"dateFrom": "2000-01-01",
"dateTo": "2021-11-25",
"format": "html"
}'
curl -L -X POST 'http://localhost:3000/api/v1/rooms.export' \
-H 'X-User-Id: d26x6zSkaPSe5gCyy' \
-H 'X-Auth-Token: Zu-Z6eKzIIz7MCCRGeHi29bYkXZCJ4SxFC0JAasqm92' \
-H 'Content-Type: application/json' \
--data-raw '{
"rid": "iu7jtPAhvEeAS5tNq",
"type": "email",
"toUsers": ["test.user"],
"toEmails": ["test@test.com"],
"messages":["yd6NBgNoiWATgDoFt","BoCjicj9DdYoMHHeo", "tajMB3aX3sawFWe8W"],
"subject": "Test Subject "
}'
{
"success": true
}
Any of the following errors can occur:
- Authorization: Requires an authentication token for the request to be made.
- Invalid Params: Occurs when one or more needed parameters are missing.
- Invalid Room: Occurs when the given
rid
is invalid. - Not Allowed: Occurs when the user lacks the
mail-messages
permission and doesn't have access to the room. - Invalid Format: Occurs when the export format is not specified
{% tabs %} {% tab title=" Authorization" %}
{
"success": false,
"error": "unauthorized"
}
{% endtab %}
{% tab title="Invalid Params" %}
{
"success": false,
"error": "[error-invalid-params]",
"errorType": "error-invalid-params"
}
{% endtab %}
{% tab title="Invalid Room ID" %}
{
"success": false,
"error": "[error-invalid-room]",
"errorType": "error-invalid-room"
}
{% endtab %}
{% tab title="Invalid Format" %}
{
"success": false,
"error": "[error-invalid-format]",
"errorType": "error-invalid-format"
}
{% endtab %} {% endtabs %}
Version | Description |
---|---|
3.8.0 | Added |