Fork me on GitHub

REST module for Workflow plugin

Overview

This module provides REST web services to access to workflow's plugin data.

Configuration

Configure the private keys for the signature in the file workflow-rest.xml :

<filters>
	<filter>
		<filter-name>WorkflowRestSecurity</filter-name>
		<url-pattern>/rest/workflow/*</url-pattern>
		<filter-class>fr.paris.lutece.util.signrequest.servlet.HeaderHashRequestFilter</filter-class>

		<init-param>
			<param-name>elementsSignature</param-name>
			<param-value></param-value>
		</init-param>

		<init-param>
			<param-name>validityTimePeriod</param-name>
			<param-value>0</param-value>
		</init-param>

		<init-param>
			<param-name>privateKey</param-name>
			<param-value>change me</param-value>
		</init-param>
	</filter>
</filters>

Usage

Test JSP

There is a JSP that allow to run test on the module-workflow-rest. It is accessible through the following link :

jsp/admin/plugins/workflow/modules/rest/TestWorkflowRest.jsp

Note : To access to this JSP, one must be authenticated in the Back-Office. The filter tags must also be commented in the file workflow-rest.xml so the module won't use the security, otherwise, an HTTP 401 response will be returned.

URLs syntax for workflows

Retrieve the information of one or several workflows in format XML or JSON

XML syntax :

  • To get all the workflows :
http://myhost/mywebapp/rest/workflow
ou
http://myhost/mywebapp/rest/workflow.xml
  • To get one workflows :
http://myhost/mywebapp/rest/workflow/{id_workflow}
ou
http://myhost/mywebapp/rest/workflow/{id_workflow}.xml

JSON syntax :

  • To get all the workflows :
http://myhost/mywebapp/rest/workflow.json
  • To get one workflows :
http://myhost/mywebapp/rest/workflow/{id_workflow}.json

URLs syntax for states

Retrieve the information of one or several states in format XML or JSON

XML syntax :

  • To get all states :
http://myhost/mywebapp/rest/workflow/state
ou
http://myhost/mywebapp/rest/workflow/state.xml
  • To get one state :
http://myhost/mywebapp/rest/workflow/state/{id_state}
ou
http://myhost/mywebapp/rest/workflow/state/{id_state}.xml

JSON syntax :

  • To get all states :
http://myhost/mywebapp/rest/workflow/state.json
  • To get one state :
http://myhost/mywebapp/rest/workflow/state/{id_state}.json

URLs syntax for actions

Retrieve the information of one or several actions in format XML or JSON

XML syntax :

  • To get all actions :
http://myhost/mywebapp/rest/workflow/action
ou
http://myhost/mywebapp/rest/workflow/action.xml
  • To get one action :
http://myhost/mywebapp/rest/workflow/action/{id_action}
ou
http://myhost/mywebapp/rest/workflow/action/{id_action}.xml

JSON syntax :

  • To get all actions :
http://myhost/mywebapp/rest/workflow/action.json
  • To get one action :
http://myhost/mywebapp/rest/workflow/action/{id_action}.json

Execute an action

To perform an action, a form type POST is needed with the following parameters :

Parameter name Parameter type Description
id_action integer ID of the action (mandatory)
id_resource integer ID resource (mandatory)
resource_type text Resource type (mandatory)
  • To get a response in XML :
http://myhost/mywebapps/rest/workflow/action/do
  • o get a response in JSON :
http://myhost/mywebapps/rest/workflow/action/do.json

URLs syntax for resources

Retrieve the information of one resource in format XML or JSON

XML syntax :

  • To get one resource :
http://myhost/mywebapp/rest/workflow/resource_workflow/{id_workflow}/{resource_type}/{id_resource}
ou
http://myhost/mywebapp/rest/workflow/resource_workflow/{id_workflow}/{resource_type}/{id_resource}.xml

JSON syntax :

  • To get one resource :
http://myhost/mywebapp/rest/workflow/resource_workflow/{id_workflow}/{resource_type}/{id_resource}.json