Skip to content
This repository has been archived by the owner on Jun 27, 2024. It is now read-only.

Latest commit

 

History

History
112 lines (92 loc) · 4.85 KB

File metadata and controls

112 lines (92 loc) · 4.85 KB

Export Room

Export room to a file or email.

{% hint style="info" %} This requires the user to have the mail-messages permission. {% endhint %}

HTTP MethodURLRequires Auth
POST/api/v1/rooms.exportyes

Body Parameters

KeyExample ValueDescription
rid*JZ8Y2dLfYhsg323RfThe 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
dateFrom2020-01-13Start date to begin fetching. Use dateFrom if the type is file. By default, it selects the oldest possible date.
dateTo2021-12-13End 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*

["yd6NBgNoiWATgDoFt","BoCjicj9DdYoMHHeo", "tajMB3aX3sawFWe8W"]
An array of messageId for the messages that should be exported. It is required if type is email.
subject*Test ExportThe subject of the email. It is required if type is email.

Example Call for File Export

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"
}'

Example Call for Email Export

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 "
}'

Example Response

Success

{
    "success": true
}

Error

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