Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

SMILA/Documentation/Processing/JSON REST API for pipelets

< SMILA‎ | Documentation
Revision as of 11:08, 18 January 2012 by Juergen.schumacher.attensity.com (Talk | contribs) (Get Pipelet Overview)

Note.png
Available since SMILA 1.0!


JSON REST API for SMILA BPEL pipelines

SMILA now has an HTTP REST API that allows to display the registered pipelets as well as descriptions for single pipelets (i.e. class name, parameter description, pipelet description and other additional data).

Reference

Note: The trailing slash in URLs is optional.

Get Pipelet Overview

GET: Returns a list of all deployed pipelets which have been detected by the PipeletTracker including URLs to access their descriptions. The list also contains names of pipelets for which the pipelet description can be read from the SMILA-INF directory in the bundle, but the pipelet class cannot be successfully instantiated.

Supported operations:

  • GET: Gets a list of all registered pipelets.

Usage:

  • URL: http://<hostname>:8080/smila/pipelets/
  • Allowed methods:
    • GET (no further URL parameters and no request body allowed)
  • Response status codes:
    • 200 OK: Upon successful execution of GET.
    • 500 INTERNAL SERVER ERROR: Any other error.

Example:

GET http://localhost:8080/smila/pipelets/
200 OK
{
  "pipelets" : [{
    "class" : "org.eclipse.smila.processing.pipelets.xmlprocessing.RemoveElementFromXMLPipelet",
    "url" : "http://localhost:8080/smila/pipelets/org.eclipse.smila.processing.pipelets.xmlprocessing.RemoveElementFromXMLPipelet/"
  }, {
    "class" : "org.eclipse.smila.processing.pipelets.xmlprocessing.XPathFilterPipelet",
    "url" : "http://localhost:8080/smila/pipelets/org.eclipse.smila.processing.pipelets.xmlprocessing.XPathFilterPipelet/"
  }, {
    "class" : "org.eclipse.smila.processing.pipelets.xmlprocessing.XslTransformationPipelet",
    "url" : "http://localhost:8080/smila/pipelets/org.eclipse.smila.processing.pipelets.xmlprocessing.XslTransformationPipelet/"
  }, {
    "class" : "org.eclipse.smila.ontology.pipelets.SesameRecordReaderPipelet",
    "url" : "http://localhost:8080/smila/pipelets/org.eclipse.smila.ontology.pipelets.SesameRecordReaderPipelet/"
  }, {
    "class" : "org.eclipse.smila.aperture.pipelets.AperturePipelet",
    "url" : "http://localhost:8080/smila/pipelets/org.eclipse.smila.aperture.pipelets.AperturePipelet/"
  },
...
}

Get a Pipelet description

GET: Returns a JSON object containing the description of the requested pipelet. The object consists of the class name of the pipelet, optionally the textual description of the pipelet and the description of its parameters. Additionally to the original pipelet description read from the SMILA-INF of the bundle, the returned description can also contain errors if the pipelet class could not be instantiated (in this case the pipelet will not work properly in pipelines) or the pipelet description was not wellformed (in this case the pipelet should still work).

Supported operations:

  • GET: Get a pipelet description.

Usage:

  • URL: http://<hostname>:8080/smila/pipelets/<pipelet-class-name>/
  • Allowed methods:
    • GET (no further URL parameters and no request body allowed)
  • Response status codes:
    • 200 OK: Upon successful execution for GET.
    • 404 NOT FOUND: If the specified pipelet does not exist.
    • 405 METHOD NOT ALLOWED: For methods other than "GET".
    • 500 INTERNAL SERVER ERROR: Any other error.

Example:

GET http://localhost:8080/smila/pipelets/org.eclipse.smila.processing.pipelets.CopyPipelet
200 OK
{
  "class" : "org.eclipse.smila.processing.pipelets.CopyPipelet",
  "parameters": [        
    {
      "name": "inputType",
      "type": "string",
      "values": ["ATTACHMENT", "ATTRIBUTE"]       
    },
    {
      "name": "outputType",
      "type": "string",
      "values": ["ATTACHMENT", "ATTRIBUTE"]         
    },
    {
      "name": "inputName",
      "type": "string"            
    },
    {
      "name": "outputName",
      "type": "string"            
    },
    {
      "name": "mode",
      "type": "string",
      "values": ["COPY", "MOVE"],
      "optional": true
    }     
  ],
  "description": "This pipelet can be used to copy a string value between attributes and/or attachments. 
It supports two execution modes: COPY: copy the value from the input attribute/attachment to the output 
attribute/attachment, MOVE: same as COPY, but after that delete the value from the input attribute/attachment"
}

Example with error messages

In this example the pipelet class did not exist in the bundle, and the parameter description was not valid. Both errors are listed under the errors key:

{
    "class":"org.eclipse.smila.processing.test.InvalidClassAndParametersPipelet",
    "parameters":[
        {
            "whats-this":"not-a-parameter"
        }
    ],
    "description":"test pipelet that won't be found and has invalid parameters description.",
    "errors":[
        "Pipelet class could not be loaded.",
        "Parameters section is invalid. Missing field 'name' or it has empty value."
    ]
}

Back to the top