pentahopentaho-data-integration

Pentaho-carte rest api?


I just started with Pentaho data-integration and was able to create transformations/jobs from UI and run them from UI as well as Pentaho DI java SDK. Also, I successfully setup carte server, submitted transformation, and monitored it's status on carte webUI.

My question is:

Does carte server also exposes any JSON/XML rest API over which I can submit jobs/transformation and monitor their progress? Right now it seems to be developed only for usage through browser.

Thanks - Nitin,


Solution

  • Yes, the REST API exists.

    Carte is based on a Jetty server which is meant to be used on a web browser, but there is no reason to prevent sending/receiving request like http://your-server:9090/kettle/status?xml=true.

    However, I see two main obstacles: First you will receive html from which you have to extract the relevant information. It is not difficult to do but it has to be done by you.

    Second, is the documentation. The community documentation is rather short, and the EE edition documentation does not address the question. There is an underground documentation but is may be outdated (or it may exist a more recent I do not know about).

    So you are bound to crawl in the forum and in the sources [source][5]. in the org.pentaho.di.www package you find a lot of *Servlet.java, each one corresponding to an action whose url is defined at the beginning of the class in the variable CONTEXT_PATH.

    For example, the class org.pentaho.di.www.RunTransServlet.java contains on line 58: public static final String CONTEXT_PATH = "/kettle/runTrans"; indicating the url to run a transformation is http://your-server:9090/kettle/runTrans?.... Then you now you have 2 parameters the transformation name and the log level either by looking in the html doc on lines 68-145, either by reading the code of the doGet method.

    It is much easier than it sounds (thanks to Matt Casters and Jens Bleuel gift in software engineering).

    I did myself a small ajax interface with less information. It was before they invented this CORS stuff, so you have to check that the Access-Control-Allow-Origin: * is written to the response header.

    So, if you are brave enough and plan to do something in that direction, keep me up to date and do not hesitate to request help.