Apache Hop server web service setup
Introduction
The web service component of Apache Hop allows you to expose data and functionality through a web interface, making it accessible via HTTP requests.
Don’t let the slightly dated user interface deceive you. Give Hop a chance because, beneath the surface, it’s a highly powerful and efficient data integration platform. Even though I’ve experimented with various innovative BI software, I consistently return to Pentaho, and now Apache Hop, for building complex ETL processes.
Requirements
Make sure the Hop Server is configured to use a project and an environment. Also make sure the metadata of the project is used.
Setup
To setup the web service and build pipelines and workflows, you need to download the Hop GUI. Alternatively, you can use Hop Web (currently in development). I’ll be using the Hop GUI on Windows and starting it with hop-gui.bat
.
-
Create a new project:
-
Use lifecycle environments, for example, to create a
development
environment andproduction
environment. Then you can configure variables for each environment. As an example I have added the following environment and variable: -
Create a pipeline by clicking
File
>New
andPipeline
. Then I will only add two transforms/steps: FirstGet variables
with a field containing the value of the environment variable and a field containing the value of the parameter passed in the urlAnd second
JSON output
which will return a JSON output block and the fieldsNow the pipeline looks like this:
And this is the XML of the pipeline which you can use:
-
Create the web service metadata by clicking the
metadata
button all the way left and in the list right-clickWeb Service
and choose forNew
. Enter the following:- Name: for example
test
- Make sure Enabled is turned
ON
- Filename on the server:
${PROJECT_HOME}/webservice-test.hpl
- Output transform:
JSON output
- Output field:
outputValue
- Content type:
application/json
- Turn List status on server
ON
Now save the changes.
Now the
test
web service is added to your metadata: - Name: for example
-
Make sure everything is saved and copy the project with the metadata to the data folder of the Hop Server. Do the same with the environments (the env folder)
-
Make sure the Hop Server container is running and finally test if the web service works by entering the following url:
http://<hop server IP>:<hop server PORT>/hop/webService/?service=test&myparam=hop
Enter your username and password and you will get the result in the browser:
The display of the json output may differ per browser.
The web service can also be tested with
cURL
:When you look at the server status (
http://<hop server IP>:<hop server PORT>/hop/status
). You will see that the pipeline is now added with statusFinished
:
No comments found for this note.
Join the discussion for this note on Github. Comments appear on this page instantly.