Sample workflow creation and text version of these instructions attached
#01 Login
curl "http://:8086$host/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 workflow
curl "http://:8086$host/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://:8086$host/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"
}"
Values for Type
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://:8086$host/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://:8086$host/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://:8086$host/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://:8086$host/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://:8086$host/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://:8086$host/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://:8086$host/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://:8086$host/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://:8086$host/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://:8086$host/webresources/migrations/1/$workflow_id" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM="
#######################
Additional API calls#
#######################
Get List of all workflows
curl "http://:8086$host/webresources/workflows/1/short" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM="
Delete specific workflow (by id)
curl "http://:8086$host/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 db connections
curl "http://:8086$host/webresources/connections/1" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM="
Delete db connection by id
curl "http://:8086$host/webresources/connections/1/$id" -X "DELETE" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM="
Update the db connection details
curl "http://:8086$host/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://:8086$host/webresources/maskingsetup/1/getMaskingMethods" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM="
Export the full Workflow
curl "http://:8086$host/webresources/workflows/1/$workflow_id" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46MjEyMzJGMjk3QTU3QTVBNzQzODk0QTBFNEE4MDFGQzM="
#Add a pre/postScript
curl "http://:8086$host/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://:8086$host/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"
} ]
}"