2022
Overview
DBSync Cloud Replication can run replication processes using Web API thus allowing usage of Web Service calls to initiate the process of replication. Users can use the URL thus generated to run or execute the commands or check status of an existing command by using the POST or GET call methods respectively. A process ID is provided for the user to check the status of the command that was run. It supports the four functions of Cloud replication: Clean copy, Update Schema, Source to Database and Database to Source.
Problem Statement
With DBSync Cloud replication you get an exe. or a zip file based on your environment and you run the application. Once the server starts you basically go to the browser to run the various functionalities of Cloud replication by using the User Interface. This process requires manual intervention for running the various commands, check logs etc. This is a swagger interface for replication API. DBSync Cloud Replication Web API allows the user to run these functions programmatically. The process of Asynchronous calling is applied where you can run an existing process or pass all parameters in real time.
Setting Up of Web API
To set Web API:
- Login to DBSync Cloud Replication instance
From the left panel click on the icon
From the left navigation toolbar click on Administration
- From the drop-down menu select API
- You will be redirected to a DBSync swagger interface for our replication API
- Click on Authorize
Provide the User name Password for your profile. (will match the DBSync login credentials)
Click Authorize
A pop-up confirming authorization as AUTHORIZED will appear on the screen
- This is done for authentication purposes so only the specific User can Call the API and no one else can on the User’s behalf. Only when it is authenticated the user can run the requests.
- The URL should be passed to run the replication using Web API. There are 2 options for sending :
a. Replicate : This is to trigger the replication process
Click on this to configure the API call to trigger a replication process.
This will include details of : Salesforce, Database, Objects, Logs, Callback API, Run command option
There is an example of a payload provided for the user to configure the API calls:
Replace the sample values with actual values and execute the command.
Click on TRY IT OUT
You will get an editable payload format where you can enter all the details and configure the API Call.
You can execute the API call by Profile name or configure all the settings for a profile and run the API calls.
For example:
Let us first configure the Salesforce Instance:
The same details which are in the UI will be entered as values in the JSON. In place of String replace with actual text and enter True or false where applicable.
For this example consider the below image from the UI for filling in the Salesforce details:
Sample Payload | Actual Payload |
Salesforce | Salesforce |
{ "salesforce": { "soapEndpoint": "string", "bulkApiEnable": true, "password": "string", "username": "string" }, | { "salesforce": { "soapEndpoint": "https://login.salesforce.com/services/Soap/u/47.0", "bulkApiEnable": false, "password": "xxxxxxxx", "username": "dbsync.replicationtest@gmail.com" }, |
This will set up the Salesforce instance for the above mentioned Profile and for this specific User Name. The URL for the soap endpoint can be taken from the UI. In this instance we do not want Bulk API so we enter as false. Provide the Username and password for the Salesforce instance | |
Database | Database |
Will split this into 3 parts: | |
"database": { "fileReplication": true, "fileVersion": true, "filepath": "string",
"s3": true, "awsAccessKey": "string", "awsBucketName": "string", "awsRegion": "string", "consumerSecret": "string", "database": "string", "host": "string", "password": "string", "port": "string", "schema": "string", "type": "string", "url": "string", "username": "string" }, | "database": { "fileReplication": true, "fileVersion": true, "filepath": "string",
"s3": true, "awsAccessKey": "string", "awsBucketName": "string", "awsRegion": "string", "consumerSecret": "string", "database": "xxxxxxxxxx", "host": "localhost", "password": "xxxxxxxxx", "port": "0000", "schema": "public", "type": "mysql", "url": "jdbc:mysql://localhost:3306/performance_schema", "username": "xxxx" }, |
PART 1: | |
"database": { "fileReplication": true, "fileVersion": true, "filepath": "string",
| "database": { "fileReplication": true, "fileVersion": true, "filepath": "C:/DBSync_CloudCDM/files", |
NOTE: This is a file based data type. Salesforce has file based objects. There are attachments, documents and content base. If you want data as a physical file instead of a database use PART 1. You can get the raw data file in your local system.
File Version: This function enables the user to have the same file name stored multiple times. It will not override. If you want to have this versioning then select true if not false. In the UI you can see these 3 fields under ADVANCED SETTINGS. Refer image below: Download files to Directory: File Path Keep multiple Version of Files: File Version | |
PART 2: | |
"s3": true, "awsAccessKey": "string", "awsBucketName": "string", "awsRegion": "string", "consumerSecret": "string", | "s3": true, "awsAccessKey": "string", "awsBucketName": "string", "awsRegion": "string", "consumerSecret": "string", |
NOTE: For databases such as AWS REDSHIFT the transfer of data is slow. Hence S3 bucket is used to transfer data as it is much faster and easier. Any data from Salesforce would be dumped into the S3 bucket and from there the transfer is done. So ONLY IF THE DATABASE IS AWS REDSHIFT fill these columns: | |
PART 3: | |
"database": "string", "host": "string", "password": "string", "port": "string", "schema": "string", "type": "string", "url": "string", "username": "string" }, | "database": "xxxxxxx", "host": "localhost", "password": "xxxxxx", "port": "0000", "schema": "public", "type": "mysql", "url": "jdbc:mysql://localhost:3306/performance_schema", "username": "xxxx" }, |
NOTE: Enter details of the database in this section | |
Object | Object |
"objects": [ { "excludes": [ "string" ], "filter": "string", "name": "string" } ], | "objects": [ { "excludes": [ "xxx" ], "filter": "name=’Test_2021’", "name": "xxxx" } ], |
NOTE: Name: the Name of the object you want to store/Sync. For eg: Account For eg: If you do not wish to sync FAX then you can enter this in the exclude column. "Fax" If you want to add more than one field to exclude For eg: phone number: "Fax", ”Phone” Also note that this is for one OBJECT. You can repeat the same for any number of objects that you wish to sync: { "name": "Attachment" } To add another Object named Attachment. | |
Logs | Logs |
"log": { "emailError": true, "database": true, "dir": "string", "emailRecipients": [ "string" ], "emailSender": "string", }, | "log": { "emailError": true, "database": true, "dir": "C:/xxx_xxxM/xxxx_logs_dir", "emailRecipients": [ "xxxxxx@gmail.com" ], "emailSender": "xxxxxxt@gmail.com", }, |
NOTE: Email Error: If the user wants to get notified only in case of an error during a sync then this can be entered. It is a true/False field "EmailSender": "string",: User can choose who should be the sender(email ID of sender) This is an optional field. By default it is DBSync. This is to allow permissions for sending the calls. "EmailRecipients": [ : User can choose who should be the recipient (email ID of receiver) "string" "dir": "string", : this is alternative directory that the user can create to store the log files in their systme Database: If the user wishes to store all information in the database and not in any logs files in the system then enter as true. The logs will be stored as a separate table in the database row-wise. | |
Callback URL | Callback URL If you wish to run the Call from the server enter the URL in this section. |
"callbackURL": "string" | "callbackURL": "xxxxxxxx@dddd.com" |
Run | Run |
"run": { "command": "string", "profile": "string" } | "run": { "command": "cleancopy", } |
NOTE: Profile section : Use this if you want to run a sync from the profile name. Run: Enter the command or function you wish to do. For eg: Clean Copy, Update Schema, Source to DB, DB to Source The below is an example showing how to run Clean Copy functionality for the profile DBSynctest { "run": { "command": "cleancopy", "profile": "xxxxxx" } } |
Click Execute
The responses will appear as CURL
A request URL is given in the REQUEST URL BOX
Response Body
Status, Submit time, Process ID and CallbackURL can be found in this section.
You can also see the Status as submitted if successfully submitted or Failed if any error.Process ID:
The process ID is used to check STATUS of a running process or can be used as a trigger.
b. Check Status(POST) : This is to check the status of the replication process
Enter the Process ID acquired in the 1st option to get the status and Click Execute
The status will show as in-progress or complete.