RapidMiner

Passing parameters to Rapidminer Webservices

by RMStaff on ‎06-15-2016 06:51 AM - edited on ‎09-21-2016 10:45 AM by Community Manager

 

 

 

Rapidminer provides excellent capabilities to operationalize predictive analytics by simply converting RapidMiner workflows into webservice end points that can return data in various formats like XML, JSON, Odata, HTML and many other. Many a times there is a need to provide inputs to process when calling via webservice, This KB Article describes options and steps needed to provide parameters to web services.

 

The process to create web service from RapidMiner workflows is documented in this KB Article

 

Rapidminer webservice allows you to provide url based inputs that can affect

    • Macros
    • Operator Parameters

parameterbinding.png

This can be configured in the Edit Web service panel as seen above

 

Macro Binding

To map a url parameter to Query Parameter click on "Add Macro Binding"(Marked 1 above) 

In this case the url parameters "custid" is mapped to update the macro "Customerid"

Addtionally if you have already defined Macros in the process context then clicking on the "Copy from process context" will autofill the required parameter binding values. 

 

Operator parameter Binding

You can directly map a url parameter to a parameter for specific operator.  As seen below provide your url parameter name in place or "urlparam"

Provide your operator name in place of "operator_name" and the specific parameter in place of "operator_parameter"

parameterbinding2.png

 

You will also be able to specify if a particular parameter is mandatory or not, by clicking on the checkboxes next to each parameter binding.

 

Once completed hit the "Submit" button to save the configuration

 

An example of the request url in the case where you are mapping a macro and operator param will look like below.

 

http://myservername:port/api/rest/process/serviceid?custid=xxxx&urlparam=yyyyy

 

 

Comments
M_Martin
Super Contributor

Thank you for this post.  I am a new RM Server User.  I have published a Process and created a Web Service - which I have configured as follows:

Output format: JSON

MIME Type: Application/json.

 

I test the servide, and out xcomes json text - if I copy the output and paste it into a text file and save it with a .json extension, I can connect to this file in Tableau Desktop as Tableau can read .json files.  

 

How can I configure my RM Server web service to generate a .json file?  Or do I need to do that within the Process itself using the "Data to json" Operator?  Thanks for any guidance anyone can provide.  Best wishes, Michael

Moderator
Moderator

Dear Martin,

 

i would recommend to use ODATA to directly embedd into tableau, Have a look at this docu: https://rapidminer.com/resource/rapidminer-tableau-integration/

 

Best,

Martin

M_Martin
Super Contributor

Hallo Martin:

Thanks for your reply above - and yes ODATA works fine - Tableau creates an extract upon connection and I can then work with the data stream emitted from my web service within Tableau.  Am teally interested in the methods discussed in the link you sent me, as it appears that there is a direct connection to the data (not an extract) which allows for parameterozed calls to a web service.  Good stuff - and would like to learn more about that.  Best wishes, Michael

 

Moderator
Moderator

Hey,

have you had a look at this overview article? http://community.rapidminer.com/t5/tkb/articleprintpage/tkb-id/GetStartKB/article-id/15 There are quite some links to details.

 

~Martin

M_Martin
Super Contributor

Thank you for your email - and yes I have successfully configured a RapidMiner Service using oData and I have worked with the Tableau Web Connector SDK.  When Tableau connects to an oData data source, Tableau needs to make what is called an Extract (wherein the data is loaded into a proprietory Tableau "cube" format) before you can work with the data within Tableau.  This means that you can't really change parameters (to generate a singleton prediction or new predictions in light of filtering, etc.) and "call back" to RapidMiner without manually refreshing the data source, which results in Tableai creating another extract.  The Web Connector also buuilds Tableau Exracts of streaming data after it has been parsed - which means that if you want to "call back" to RapidMiner Server, you have to re-connect to your web data source using your web connector, and Tableau will build another extract before you can work with the data.  If you simply want to download data and work with it all in Tableau, and refresh it once in a while, than oData and the web Connector do the trick.  

The link you sent me the other day (https://rapidminer.com/resource/rapidminer-tableau-integration/) looks to be the solution I'm looking for wherein you can "call back" to RM Server within Tableau with a live data connection (no extract) just as you can within Tableau and R - via a calculated field.  Can you please help me get access to this technology?  I would be happy to devote some time to testing it providing feedback.  thanks for considering my request, and best wishes, Michael