Page tree
Skip to end of metadata
Go to start of metadata

REST API 

The REST API provides programmatic access to Read and Write replication data. The REST API identifies the replication application and its users using OAUTH; responses are available in JSON.  We have used the SWAGGER editor for the end-users to make the API calls so that they can try out APIs exposed by our platform. 

The link for accessing the API docs is http://localhost:8080/webapi/api-docs/repl-v4/ReplicationAPIDriver 

Checklist Before Getting Started 

  1. Users should have a release of 6x or later.
  2. The on-premise instance should have a Replication service running.

There are two API Methods list which is exposed for this release, we will be adding more methods in the upcoming releases. The order of the execution of API calls are as follows 

  1. Replicate
  2. checkStatus

/replicate

The Replicate method is the actual API call used to invoke the replication process so that the Salesforce objects get replicated to the Database. From this call, the process id is generated which is used in the check status method to check the status of the replication process.

The below tables explains the various model schema and attributes which form the model class 

Replication params 

Parameter

Description

DataType

Salesforce (optional)

The salesforce credentials which are required to connect to the Salesforce instance

Salesforce

Database (optional)

The database credentials which are required to connect to supported databases

Database

Objects (optional)

The Salesforce object which a client to replicate

Array Table

Logs (optional)

The parameters related to Log settings and specific to DBSync

Log properties

Run (optional)

The parameters related to run settings and specific to DBSync

Run properties

Salesforce Params

Parameter

Description

DataType

SoapEndpoint (optional)

The URL to access the salesforce application

string

bulkApiEnable (optional)

The possible values are True and false which enables and disables the bulk API calls

boolean

callbackurl (optional)

The DBSync call back URL

string

consumerkey (optional)

Its a consumersecretkey generated  from salesforce OAuth

string

ConsumerSecret (optional)

It's a consumerSecret generated from the salesforce OAuth

string

password (optional)

The password of the salesforce instance

string

username (optional)

The username of the salesforce instance from which the user wishes to retrieve information for replication

string

Database Params

Parameter

Description

DataType

filereplication (optional)

The possible values are true and false to enable and disable the file replication

boolean

s3 (optional)

The possible values are true and false, true if hosted on AWS S3

boolean

awsaccesskey (optional)

awsaccess key if db is hosted on AWS S3, can be retrieved from the AWS S3 instance

string

awsBucketName (optional)

awsBucketName if db is hosted on AWS S3, can be retrieved from the AWS S3 instance

string

awsRegion (optional)

awsRegion if db is hosted on AWS S3, can be retrieved from the AWS S3 instance

string

consumerSecret (optional)

ConsumerSecret if db is hosted on AWS S3, can be retrieved from the AWS S3 instance

string

database (optional)

Name of the database Eg: Sqlserver/Oracle/Mysql

string

host (optional)

The location of the database for instance localhost

string

password (optional)

the password of the database if any

string

port (optional)

port number the database instance which uses

string

schema (optional)

The name of the database

string

type (optional)

Specify the database that is being used Eg: Oracle

string

URL (optional)

The URL of the database which is generated by the replication in the connection string

string

username (optional)

The username of the database

string

Table Params

Parameter

Description

DataType

excludes (optional)

If the user wishes to remove any of the fields from the selected object in salesforce then he can use this parameter

Array[string]

filter (optional)

The filter parameter is used to specify the condition to read data from salesforce

string

name (optional)

Name of the object that needs to be retrieved from the salesforce

string

Log Properties params

Parameter

Description

DataType

emailerror (optional)

The possible values are true and false to enable them and disable the email notification from DBSync replication tool

boolean

database (optional)

The possible values are true and false to enable them and disable the email notification of database from DBSync replication tool

boolean

dir (optional)

The directory name if the database if flat file database

string

emailreceipents (optional)

The email id of the recipient to who the system is intended to send out the logs/notifications

Array[string]

emailsender (optional)

The email id of the sender can be also be passed to identify the from address

string

callbackURL (optional)

The DBSync URL which sends the email notifications

string

Run Properties Params

Parameter

Description

DataType

command (optional)

The commands which are internal to DBSync replication like Cleancopy, DBtoSF, SFtoDB,db_setup

string

Profile (optional)

The profile name which user used in DBSync replication tool

string

Below table gives the attribute list of the response class

Parameter

Description

Data type

Status

The possible values are True and False which sends out the response value

String

SubmitTime

The API submitted time

Date

CompletionTime

The API Completion Time

Date

ProcessID

The process id which is sent by the API to identify the process

String

callbackURL

The URL is passed from the API

string

Example 
Curl
curl -X POST "http://localhost:8080/webapi/appcode/repl-v4/ReplicationAPIDriver/replicate" 
-H "accept: application/json" -H "Content-Type: application/json" 
-d "{ \"salesforce\": { \"soapEndpoint\": \"https://ap4.salesforce.com/services/Soap/u/44.0\",
 \"password\": \"avankia1\", \"username\": \"demo.dbsync@avankia.com\" }, \"database\"
: { \"database\": \"testdb\", \"filepath\": \"string\", \"host\": \"localhost\", \"password\"
: \"avankia1\", \"port\": \"3306\", \"schema\": \"dbo\", \"type\": \"MySql\", \"url\"
: \"jdbc:mysql://localhost:3306/testdb\", \"username\": \"root\" }, \"objects\"
: [ { \"name\": \"Account\" } ], \"run\": { \"command\": \"cleancopy\", \"profile\": \"test1\" }}"
Request URL
http://localhost:8080/webapi/api-docs/repl-v4/ReplicationAPIDriver 

Response Body
[
  {
    "status": "submitted",
    "submitTime": "2020-01-31T12:03:08Z",
    "processId": "test1/cleancopy"
  }
]

Response Code
h6. 200
Response Headers
cache-control: no-cache, no-store, max-age=0, must-revalidate  content-length: 90  
content-security-policy: default-src 'unsafe-inline' 'unsafe-eval' 'self' *.intuit.com 
*.gstatic.com *.googleapis.com av-web.s3.amazonaws.com; frame-ancestors
'self' localhost *.salesforce.com *.force.com;  content-type: application/json 
 date: Fri, 31 Jan 2020 12:03:08 GMT  expires
: 0  pragma: no-cache  x-content-type-options: nosniff  x-frame-options: 
ALLOW-FROM DENY  x-xss-protection: 1; mode=block 


/checkStatus

The Check status method is used to return the status of the replication process and to invoke this method user must have the process id attribute . The process id can be generated from the first method "Replicate", the check status method has two parts to it one is the request object and the other is the  response object.

The below table explain the attributes and their description of this method.  The process ID is the mandatory attribute used to invoke this call. 

Parameter

Description

Data type

Status

The possible values are True and False which sends out the response value

String

SubmitTime

The API submitted time

Date

CompletionTime

The API Completion Time

Date

ProcessID

The process id which is sent by the API to identify the process

String

callbackURL

The url is passed from the API

string

Example 
Curl
curl -X POST "http://localhost:8080/webapi/appcode/repl-v4/ReplicationAPIDriver/checkStatus" -H "accept: 
application/json" -H "Content-Type: application/json" -d "{ \"processId\": \"test1/cleancopy\"}"

Request URL
http://localhost:8080/webapi/appcode/repl-v4/ReplicationAPIDriver/checkStatus

Response Body
[
  {
    "status": "completed",
    "submitTime": "2020-01-31T12:03:08Z",
    "completionTime": "2020-01-31T12:04:40Z",
    "processId": "test1/cleancopy"
  }
]

Response Code
 200
Response Headers
cache-control: no-cache, no-store, max-age=0, must-revalidate  content-length: 130
content-security-policy:default-src 'unsafe-inline' 'unsafe-eval' 'self' *.intuit.com
*.gstatic.com *.googleapis.com av-web.s3.amazonaws.com; frame-ancestors 'self' localhost 
*.salesforce.com *.force.com;  content-type: application/json  date: Fri, 31 Jan 2020 12:11:47 
GMT  expires: 0  pragma: no-cache  x-content-type-options: nosniff  x-frame-options:
ALLOW-FROM DENY  x-xss-protection: 1; mode=block 



  • No labels