Imixs Workflow ...the open source workflow technology

JEE

The Imixs REST Service

REST is an architectural style that can be used to guide the construction of web services in a more easy kind as a service which uses the SOAP specification. The Imixs JEE Components provide a REST Service Implementation which allows you to use the Imixs Workflow in a RESTfull way.

Resources and URIs

An URI is a unique resource identifier. In REST an URI represents a resource and is used to get or modify a resource. In the meaning of the Imixs Workflow Technologies the URIs represent WorkItems, Attachments, Reports or any other kind of Object provided by the Imixs Workflow. There are three main resources available where each represents one different aspect of the Imixs Workflow components:

URI Resource Description
/workflow The Workflow resource provides resources and
methods to get, create or modify workitems
/model The Model resource provides resources and methods
to get, create or modify a workflow model entities
/report The Report resource provides resources and methods
to get the result of a report definition

Each of these resources provides a set of sub resources which represent an object managed by the Imixs Workflow components.

The following table is a shortlist of all URIs defined by the Imixs REST Service.

URI Description
/workflow/worklist a collection of workitems representing the
worklist by the current user
/workflow/statuslist a collection of workitems representing the
statuslist by the current user
/workflow/[$uniqueid] a single workitem represented by the
provided uniqueid
/model/versionlist a collection of model versions provided
by the workflow manager.
/model/[$modelversion] a collection of model entities from a
specific model version.
/report/[reportname] a collection of workitems as the result of
a report created with the Imixs eclipse
report plugin.

Each of these resources will be represented in a XML structure. But you can extend the resource with a sufix which indicates optional representation of the resource

resource sufix description
.xml this is the default xml representation
.html an html representation depending on the type
of the resource
.txt textual representation depending on the typ
of the resource

So for example if you request the resource

 /workflow/worklist.html

you will receife a HTML Page with the users worklist. The following ressource will return the XML representation of the same list.

 /workflow/worklist.xml
 /workflow/worklist

The following sections will explain the different resources provided by the Imixs Rest Service in more detail.

WorkItem URI

Basicly you can access a workitem thought the Imixs REST Service by an URL. The following URI allows you to open a single workitem by using the $Universalid as the key value.

Syntax:

 http://Host/WorkflowApp/workflow/$UniquelID

Where: WorkflowApp is the name of the Web Module where the REST Service resides. As the Web Module is using the Imixs JEE Workflow Implementation this also maps to an Database behind the Web Container (for details see JEE Workflow ). $UniqueID should be a valid UniqueID of an existing workitem.

WorkItems which are not accessible by a user can't be opened by a URI. So you can’t use this URI command to access workitems for which you are not allowed to open them

To get an HTML or Text representation use the sufix .html or .txt. If you leave it or use .xmlthe REST service will return the corresponding workitem in a xml format.

The URI always returns exactly one or non workitem to the corresponding uniqueID. It is not possible to get more then one workitem!

However, the match of the $UniqueID is not case sensitive.

WorkList URI

If you use the /workiList URI the rest service will return a collection of all workitems of the current users worklist.

Syntax

http://Host/WorkflowApp/WorkList

You can navigate throught the list with the URI params explained later in this document.

Note:
The Imixs JEE Workflow manages the access to workitems by individual access lists per each entity. So the result of a collection of workitems will only contain entities where the current user has a read access right. Without that right the wokitem will not be returned by the workflowManager and so it will not be included in the list.

Workitem Collections by other methods

To access a WorkItems by other keys as the universal ID you can call a specific getter method instead of the URI /workitems/. The key value behind the getter method is the value expected by the getter method.

Syntax

http://Host/WorkflowApp/method?key

Where: method is one of the getter methods form the WorkflowManagerService Interface:

  • WorkListByGroup * WorkListByProcessID * WorkListByCreator * WorkListByRef

If the key value matches to corresponding workitems the URI will return a collection of workitems.

Notice: There may be more than one matching workitems . To access exactly one workitem you must identify this worktiem by the URI:

Access File Attachments of a WorkItem

You can access a File Attachment stored in the $file attribute of a workitem using the /$file/ URI extension.

Syntax

http://Host/WorkflowApp/$UniquelID/$file/filename

Where: $file identifies that only a file with the name "filename" should be returned by the Service. Optional parameters are not defined here.

XSL Transformation

You can transform the XML output of a Worklist or single WorkItem into another format using a XSLT Process. Therefor you use the Query Parameter "xsl"

Syntax

http://Host/Database/Workitems/$UniquelID?openxml&xsl=myfile.xsl

A XSL File needs to be accessable form the Web Moudle of your JEE Application. If you store the XSL File into the classes root of a web application a typical URL for a XSL Request looks like the following example:

Example

http://myhost/Database/Workitems?openxml&xsl=WEB-INF/classes/stylesheet.xsl

Report URI

You can request the result of a Report generated using the Imixs Eclipse Report Plugin.

Syntax

http://Host/WorkflowApp/report/reportfile

The reportfile must match the file name used by the Eclipse plugin. The file extention .ixr is optional. You can request different formats of a report equals to the request of the workList.

Optional you can provide the service with dynamic EQL params if defined in the EQL statement. In this case you simple add the params to the query string.

Example:

http://Host/WorkflowApp/report/reportfile.xml&1=customer

This request provices the REST Service with an EQL param "customer" which will be replaced by the dynamic EQL param '?1' used in the EQL statement.

Resource Options

You can specify additional URI paramters to access only a subset of workitms by a collection method URI. This is useful to get only a subset of the whole worklist and to navigate through a list of workitems.

Append optional arguments to define the number of workitems returnd by a URL and the starting point inside the list. Combine any of the following arguments for the desired result.

option description example
count number of workitems returned by a collection ..?count=10
start position to start workitems returned by a
collection
..?start=5&count=10
xsl Optional XSL Template for a XSL Transformation xsl=WEB-INF/classes/template.xsl
contenttype Optional content type used in a XSL transformation contentype=application/pdf
encoding Optional character encoding for the output result encoding=ISO-8859-1
download Optional filename for a download request
This generates the HTTP Header
Content-disposition,attachment;filename=example.pdf
download=example.pdf