API instructions
Sample workflow creation and text version of these instructions attached
#01 Logincurl "http://$host:8086/webresources/user/login" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM=" --data-raw "{
"name":"$username",
"password":"$pass"
}"
#02 Create the new workflowcurl "http://$host:8086/webresources/workflows/1" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM=" --data-raw "{
"name":"$workflow_name"
}"
03 Create Database Connection (the same for Source and Destination)
curl "http://$host:8086/webresources/connections/1" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM=" --data-raw "{
"name":"$dbSource",
"type":$type,
"agent":"Manager_with_Agent",
"host":"$src_db_host",
"port":$port,
"dbname":"$dbname",
"userName":"$db_user",
"password":"$db_pass"
}"
Allowed values for “type” field:
1 - MySQL
2 - PostgreSQL
3 - Oracle
4 - CSV
04 Assign db connection to specific workflow (as source or/and destination) - Options section can be removed
curl "http://$host:8086/webresources/workflows/1/$workflowid" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM=" --data-raw "{
"id":$workflowid,
"migrationStatus":2,
"source":$dbsourceid,
"destination":$dbdestid,
"options":
{
"overwrite":"Databases",
"numOfProcesses":4,
"stagingDirectory":"stage",
"logDirectory":"log",
"continueOnErrors":true,
"preScript":null,
"postScript":null},
"databases":[],
"tables":[]
}
}"
05 (Re)load list of databases (schemas) to workflow
curl "http://$host:8086/webresources/workflows/1/$workflow_id/reload/databases" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM=" --data-raw "{}"
06 Get the list of databases in the workflow
curl "http://$host:8086/webresources/workflows/1/$workflow_id" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM="
07 Select specific databases for copy - the false DBs can be left out
curl "http://$host:8086/webresources/workflows/1/$workflow_id" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM=" --data-raw "{
"id":$workflow_id,
"migrationStatus":2,
"source":$dbsourceid,
"destination":$dbdestid,
"options":
{"overwrite":"Databases",
"numOfProcesses":4,
"stagingDirectory":"stage",
"logDirectory":"log",
"continueOnErrors":true,
"preScript":null,"postScript":null
},
"databases":[{
"isActive":true,
"name":"$SRCschemaName",
"destinationName":"$DSTschemaName"
}],
"tables":[]
}"
08 Create a list of available tables
curl "http://$host:8086/webresources/workflows/1/$workflow_id/synchronize/tables" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM=" --data-raw "{}"
09 Output the updated table list
curl "http://$host:8086/webresources/workflows/1/$workflow_id" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM="
10 Get the schema for a specific table
curl "http://$host:8086/webresources/tablemasking/1/$workflow_id/getSingleTableMasking" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM=" --data-raw "{
"wfName": "$workflow_name",
"sourceDatabaseName": "$dbSourcename",
"sourceTableName": "$dbsourcetable"
}"
11 Mask specific columns
curl "http://$host:8086/webresources/tablemasking/1/$workflow_id/updateSingleTableMasking" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM=" --data-raw "{
"wfName" : "$workflow_name",
"connectioName" : null,
"sourceDatabaseName" : "$dbSourcename",
"schemaName" : "",
"sourceTableName" : "$dbsourcetable",
"columns" : [ {
"columnName" : "$columnname",
"methodId" : $maskingmethodid,
"methodName" : "$maskingmethodname",
"parameters" : null,
"active" : true
} ]
}"
12 run the workflow
curl "http://$host:8086/webresources/migrations/1/$workflow_id/run" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM=" --data-raw "{"run_mode":null}"
13 Check the status of the workflow
curl "http://$host:8086/webresources/migrations/1/$workflow_id" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM="
The migration status is also indicated by numbers. It is better to rely on the numbers rather than the percentage for tracking.
The basic mapping is:
1,2,3,4,5 - running
6 - completed successfully (not running anymore)
7 - completed with errors (not running anymore)
The full mapping of numbers is:
0 - STATUS_NOT_RUN
1 - STATUS_SCHEDULED
2 - STATUS_STARTED
3 - GROUP_PREPARE
4 - GROUP_COPY_DATA
5 - GROUP_FINALIZE
6 - STATUS_FINISHED
7 - STATUS_ERROR
8 - STATUS_STOPPED
9 - STATUS_PENDING
10 - STATUS_STOPPING
#######################
Additional API calls#
#######################
Get List of all workflows
curl "http://$host:8086/webresources/workflows/1/short" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM="
Delete specific workflow (by id)
curl "http://$host:8086/webresources/workflows/1/$workflow_id" -X "DELETE" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM="
Get list of all defined database connections
curl "http://$host:8086/webresources/connections/1" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM="
Delete database connection by id
curl "http://$host:8086/webresources/connections/1/$id" -X "DELETE" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM="
Update the database connection details
curl "http://$host:8086/webresources/connections/1/$id" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM=" --data-raw "{
"id":id,
"name":"$newName",
"type":$type,
"host":"$db_host",
"port":$port,
"serviceName":null,
"dbname":"$new_dbname",
"userName":"$db_user",
"password":"$db_pass",
"certificateDN":null,
"agent":"Manager_with_Agent"
}"
Get list of available masking methods
curl "http://$host:8086/webresources/maskingsetup/1/getMaskingMethods" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM="
Export the full Workflow
curl "http://$host:8086/webresources/workflows/1/$workflow_id" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM="
#Add a Pre/Post scriptcurl "http://$host:8086/webresources/workflows/1/$workflowid" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM=" --data-raw "{
"id":$workflowid,
"migrationStatus":2,
"source":$dbsourceid,
"destination":$dbdestid,
"options":
{
"overwrite":"Databases",
"numOfProcesses":4,
"stagingDirectory":"stage",
"logDirectory":"log",
"continueOnErrors":true,
"preScript":null,
"postScript":"UPDATE Users_table SET PASSWORD_FILE='password123';"},
"databases":[],
"tables":[]
}
}"
Update masking setup for the tables that you want to mask
curl "http://$host:8086/webresources/workflows/1/$workflow_id" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM=" --data-raw "{
"id" : $workflow_id,
"migrationStatus" : 2,
"name" : "$workflow_name",
"source" : $dbsourceid,
"destination" : $dbdestid,
"options" : {
"overwrite" : "Databases",
"numOfProcesses" : 4,
"stagingDirectory" : "stage",
"logDirectory" : "log",
"continueOnErrors" : true,
"preScript" : null,
"postScript" : null
},
"databases" : [ {
"isActive" : true,
"name" : "$SRCschemaName",
"destinationName" : "$DSTschemaName"
} ],
"tables" : [ {
"isActive" : true,
"destinationDbName" : "$DSTschemaName",
"schema" : "",
"tableName" : "$sourceTableName",
"destinationTableName" : "$destinationTableName",
"whereClause" : null,
"isMasked" : false,
"isChunked" : false,
"dbname" : "$SRCschemaName"
} ]
}"