How can I set up Web Services
You can easily set up new web services in less than 5 minutes.
DataMinder comes with a demo web service installed in the default Runnables configuration delivered with DataMinder for you to start with.
The default configuration contains a demo web service at: http://127.0.0.1:9080/GetUsers
The 9080 port is the web service HTTP port set during DataMinder installation. There is an HTTPS port too.
The returned JSON is data imported from a file and looks like:
{ "columns":["FirstName","LastName","Email"] , "data":[ ["Alice","Hill","alice.hill@test.com"] ,["Bob","King","bob.king@test.com"] ,["Anne","Hart","anne.hart@test.com"] ,["Joe","Sims","joe.sims@test.com"] ,["Ieo","Bass","ieo.bass@test.com"] ,["Jane","Riley","jane.riley@test.com"] ,["Linda","Sutton","linda.sutton@test.com"] ,["Larry","Davis","larry.davis@test.com"] ,["Mary","Blake","mary.blake@test.com"] ,["Jack","Holt","jack.holt@test.com"] ,["Gustaf","Dalén","gustaf.dalén@test.com"] ,["Åsa","Sjöström","åsa.sjöström@test.com"] ] , "result":"OK"}
You can easily parse the data on a web client or parse it on some other system. Please see references at the end of this page for tools to help you with that.
In the standard Plugin Library there are 2 Web Services you can use out of the box.
- HTTP Web service: The default web service with output as above.
- HTTP web service with custom response: Web Service with a customizable response.
For more information see the plugin documentation in Plugin Library shown above.
Set up your own Web Service
To set up a web service you just need to:
- Add "HTTP Web service" to runnables in case you don't already have one
- Create a process that does something e.g. returns a user list.
- Add a HTTP Listener to the process that listen to any HTTP Web Service calls to the chosen path e.g. /GetUsers
When Should I Use Web Services?
When you want to hide complex processes and complex systems behind a well-defined simple API. Then Web Services provide great possibilities.
You just make available a number of URLs, as part of a web based API, where others can call your system in a well-defined way. They can call from a web browser or from other systems making explicit HTTP/S calls. The data used to move information is JSON which is simple and easy data format to work with.
Simple Web Service Example
Here we can imagine we have a need to expose some part of our user management to other systems. It may be a web application showing user data or some other systems updating user data e.g. when new customers sign up we store them in a backend database.
The advantage of above design is that we can easily build reusable business logic in DataMinder by grouping processes and Drag’n’Drop plugins into process. We can quickly set up a Web Service API interface allowing others to start developing with it.
We have also managed to hide all complexities of business process by a rather simple API.
Back to topSecure connection
You can set up the web service to only answer to HTTPS and require password to be accessed. To make sure only authenticated and authorized users/services are allowed access.
Build your own plugins
If you need to build custom plugins to implement your use cases you can get started in minutes. For more information how, please see DataMinder Help Plugin Development (also accessible from the main Support page).
Useful Links and Resources
Web Services
- General about Web Services at Wikipedia
- And about RESTful Web Services at Wikipedia
JSON
- JSON specification at www.json.org
Java Tools
- JSON Simple, a Java library to create and parse JSON data JSON Simple.
- JSON Path, a Java library to search and extract JSON data JSON Path.
JavaScript Tools
When calling web services asynchronously from a web page.
- JQuery a popular and easy to work with JavaScript library. JQuery can be found here jquery.com and the JSON specific API e.g. jQuery.getJSON.
- Dojo framework at dojotoolkit.org