Introduction
nodejs-dataworks is a module library for IBM DataWorks APIs. At this time, only the data load APIs are covered by this library, but more DataWorks APIs will be covered over time including "Address Cleansing" and "Data Profiling" apis.
As a reference, The Simple Data Pipe example app is using nodejs-dataworks to programmatically create activities for moving data from Cloudant to DashDB. (See the documentation here.)
This post provides documentation on how to use our DataWorks client library for Node.js.
How to use the library
var dataworks = dataload;var dwInstance = ;...
Let's take a deeper look at what's happening behind the var dwInstance = new dataworks();
code.
By default the library will automatically try to find a service bound to the application using a regular expression that contains the word "dataworks" in its name. If you know the service you want to bind to, you can always pass it as an option object like so:
var dwInstance = dwServiceName: "myDataWorksServiceName";
Once the DataWorks service is found in Bluemix's VCAP_SERVICES environment variable, the library will extract the credential information (url, userid, password) and use it in all subsequent API calls.
Note:
- This work exactly the same when running locally.
- If you use the
START_PROXY=true
env variable, the library will automatically start a proxy using the/proxy
context root. (See https://github.com/ibm-cds-labs/pipes/wiki/Instructions-for-setting-up-a-local-dev-environment-for-Simple-Data-Pipe for more information on how to configure your local environment for using the proxy).
listActivities API####
All these APIs use the callback pattern, i.e., you pass a callback function that takes an error object and an array of activities as arguments.
dwInstance;...
getActivity API####
Query an activity by its id:
dwInstance;...
getActivityByName API####
Query an activity by its name.
Note: return value can be null.
dwInstance;...
deleteActivity API####
Delete an activity by its ID:
dwInstance;...
createActivity API####
Create a new activity by specifying the source and target connection.
Note: this library uses a factory to create connections. At this time, only Cloudant and DashDB are supported.
var srcConnection = dwInstance; //Create a source connection for cloudant srcConnection; //Set the cloudant db name for the source connection srcConnection; //Specify the table var targetConnection = dwInstance; //Create a target connection for dashDB targetConnection; //Simply set the associated source connection dwInstance;...
runActivity API####
Run an activity by its ID:
dwInstance;...
monitorActivityRun API####
Monitor an activity run by its ID:
dwInstance;...
listActivityRuns API####
List all activity runs for a specified activity:
dwInstance;...
deleteActivityRun API####
Delete an activity run by its ID:
dwInstance;...