Data Backup (Export) and Import

Create a Backup (Export)

To request a backup as JSON file. You can schedule your data export to run once or periodically. Here are the following constraints:

  • Maximum total messages rows of export is limited to 5000
  • Maximum total users rows of export is limited to 1000
  • Maximum total rooms rows of export is limited to 1000
  • Maximum date range : 30 days

Request:

HTTP
Copy

Headers:

Bash
Copy

Endpoint:

[POST] /exports

Params:

KeyTypeDescription
type (required)
stringtype of resource which will be exported, permitted value are: "users", "rooms", "comments"
start_datestringusing format "YYYY-MM-DD"
end_datestringusing format "YYYY-MM-DD"

Example request:

Bash
Copy

Response:

JSON
Copy

Get List of Backup (Export)

To retrieve list of backup.

Request:

HTTP
Copy

Headers:

Bash
Copy

Endpoint:

[GET] /exports

Params:

KeyTypeDescription
page (optional)intNumber of page

Example request:

Bash
Copy

Response:

JSON
Copy

Get Backup by Id

To get backup data by Id.

Request:

HTTP
Copy

Headers:

Bash
Copy

Endpoint:

[GET] /exports/:backup_unique_id

Params:

KeyTypeDescription
backup_unique_id
stringunique id of backup 

Example request:

Bash
Copy

Response:

JSON
Copy

Delete Backup by Id

Request:

HTTP
Copy

Headers:

Bash
Copy

Endpoint:

[DELETE] /exports:backup_unique_id

Params:

KeyTypeDescription
backup_unique_idstringunique id of backup 

Example request:

Bash
Copy

Response:

JSON
Copy

Create an Import data

To create an import data.

Request:

HTTP
Copy

Headers:

Bash
Copy

Endpoint:

[POST] / imports

Params:

KeyTypeDescription
type
stringType of resource which will be exported, permitted value are: "users", "rooms", "comments"
filejson fileLimit 4 MB each import

Response:

JSON
Copy

For each type, it must follows required format as specified below:

User:

Email and authentication token must be unique, and you must have no same data (both email or unique id)in your database right now (you can check it by export it first). Password in this JSON is plain password and system will encrypted it when save to db. We encourage you to use https version of avatar url. Another key will discarded when import.

The example user format, that you should follow:

JSON
Copy

Rooms:

  • Unique id must be unique at application level (you cannot insert a new data with same unique id AND application id), and you must have no same unique id in your database right now (you can check it by export it first).
  • Avatar URL should be https.
  • If room type is single, the name inserted into db will be changed by logic using template “partcicipant1_email {space} participant2_email“, so please to make sure that if your room type is single, your participant must contains exactly 2 participant AND one of that participant is specified at CreatorEmail. Otherwise, if room type is group, Name will be the name of group.
  • CreatorEmail and all of ParticipantEmails must be exists in database (check by make an export users first).

The example rooms format, that you should follow:

JSON
Copy

Comment (Message):

  • UniqueId must be unique, and you must have no same unique id in your database right now (you can check it by export it first).
  • RoomUniqueId must be exists in database (check by export it first).
  • CreatorEmail must be exists in database.
  • We remind you to only import comment using type text or reply only, since custom format may not fully supported.

Since message has multiple type with different payload (and it must passes an validator for each type), you must specify a correct payload. You may notice that for some type, you need to pass an exact value, for example is replied_comment_id in type reply, it can be tricky since we cannot get exact value to get which comment id should be referred (because payload is saved in JSON data type and it cannot be related to any foreign key). But, thanks to RDBMS which can handle this problem. For type reply you must specify a value ParentCommentUniqueId, it can be related to comment unique id that already exist in database or UniqueId that you are specify before current object data.

Tips for import comment: Type: reply text: same as message replied_comment_id: 1, you must type literally integer 1 number, since it is means true when it came to validator service.

JSON
Copy

The example data to import, that you can follow:

JSON
Copy

Get Imported List

To retrieve list of imported data.

Request:

HTTP
Copy

Headers:

Bash
Copy

Endpoint:

[GET] / imports

Params:

KeyTypeDescription
page (optional)intNumber of page

Example request:

Bash
Copy

Response:

JSON
Copy
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard