You can use the REST protocols to incorporate IBM DataStage Flow Designer features in your custom application. You use the REST protocol to perform actions such as compiling jobs, running jobs, and getting job status.
The following REST calls are supported:
XML
JSON
For more info check out the REST API documentation.
In this lab we'll learn how to call a JSON endpoint and pipe those results to a file using DataStage.
Click on Import New Resource and browse to the newly downloaded file.
DataStage will automatically use this file as a JSON schema
New JSON schema
From the JSON Parser step, in the Configuration tab, choose the String set option and use the drop down menu. There is only one result.
Specify configuration
From the JSON Parser step, in the Documentation Root tab, specify the documentation root to be the new library from the previous step, likely called employees.
Specify documentation root
From the Output step, in the Mappings tab, click on the Map Automatically button. Remove the image profile and any others you do not want to use.
Specify mappings
Click OK to exit out of the Assembly Editor.
3. Compile and run the job
Before running the job we need to modify the Sequential File by double clicking on its icon on the designer. Specify an output file, say output.csv.
Specify output file
Also update the columns by adding the id, employee_name, employee_salary, and employee_age fields.
Specify columns
Finally, compile and run the job.
You may see an error message: Message bundle error Can't find resource for bundle com.ibm.e2.Bundle_E2_engine_msgs, key OperatorException.operatorTransitionFailedAtRuntime. To resolve this, go to the iis-server machine, go to the temp directory cd /tmp and delete the XML files rm -rf XML*. This should resolve the issue. Re-compile and re-run the job. For more info check out IBM support.
4. View output
The output file will be saved on the server. Switch to the server VM by clicking the first icon on the Environment VMs panel and selecting iis-server. Login as the root user with the password inf0Xerver.
Switch to server VM
Change your direcotory using cd to the location where you had stored the file. If you provided a path starting at "/", then it will be stored at that location in the server. Since we had only provided output.csv as the file path in the File connector, the file will be available in the Transformation project's folder, i.e.,
Finally, output your results using the cat command.