Subscribe rss
Blog categories
All | Backendless features
How to Backup Your Data Tables in Backendless
June 25, 2019 by Stanislaw Grin

Backup Data Tables

In this article, we will show you how to write a service that will backup your application data with a time interval you specify. To do this, we will be using custom business logic, a timer, and the console SDK.

The result of this operation will be an archive with the data of all your tables (or, if you wish, you can modify the service for backing up specific individual tables, geo-points, application settings, etc.).

First, we need to create a simple timer which in the future will call a service for backup.

Open your application in Backendless Console and go to the Business Logic menu on the left. Open the Timers menu and click New Timer. A modal window will appear, as in the screenshot below. You can give any name you wish to the timer, excluding spaces and wild cards. We will call it BackupDataTables. Also in this window, you can set the schedule for calling the timer. We set the value to daily, and repeat every one day.

Add New Timer

Now you should see your timer in the list:

Timer Business Logic

Next, go to the Coding tab and load your project:

Load Project from Coding Tab

Open the downloaded project in any convenient editor.

To write the service, we need the Console API. The Console API was originally meant to be internal and not used in any automation. That’s why it was never added to the Client SDKs. This wasn’t a technical decision, but rather a measure to increase the stability of the application. The operations available only with Console API are mostly those changing the database structure or some internal configurations. In our case, we will use the API to export the tables.

Using your most convenient package manager (yarn, npm), install the module backendless-console-sdk.

Now let’s create a file in the services folder. Just call it backup.js , meaning that other backup methods for other data may potentially appear in the service.

The contents of this file will be as follows (see notes in the comments in the code):


In the timers folder, find your timer and make the following changes:


Run ‘npm run deploy’ and, once deployed, go to the Console’s Business Logic menu, click on your service and then click Configure Service (gear icon):

Configure Deployed Service

The configuration modal will open:

Service Configuration

Enter Login and Password and click Save.

That’s it. If you want to check, go to the Timers tab, find your timer in the list of timers and invoke it:

Invoke Timer In Backendless

After that you can go to the Files section, open the ‘export’ folder and find your export archive. You can then download your archive and, if necessary, import into your app in the Manage > Import section.

While we hope you never need to restore your data from backups, it’s important to have a backup in place in case the worst were to happen. As they say – better safe than sorry. Happy coding!

Share this post
Tweet about this on TwitterShare on FacebookGoogle+