Extend jBPM REST API

335 views
Skip to first unread message

Vĩnh Đạt(COD) Hà

unread,
Jan 19, 2017, 5:24:27 AM1/19/17
to jBPM Usage
Hi Team,

It's possible to extend the REST services provided by JBPM 6.5.0, if yes then how to do that?

Donato Marrazzo

unread,
Jan 19, 2017, 6:38:04 AM1/19/17
to jBPM Usage

visha...@googlemail.com

unread,
May 1, 2017, 3:46:31 PM5/1/17
to jBPM Usage
Hi Donato Marrazzo,

I created extra endpoint using the first link but i am unable to get the process variable(which is stored as data object) information as kie-server and business-central uses different data sources. 

None of the current REST API supports our requirement so thought of adding extra endpoint.

Where can i get more details about extending the rest API for business-central? If I understood correctly rest-plug is like creating rest service and adding it as part of business-central lib.

I am newbie and trying to learn JBPM currently. Apologies in case i misunderstood any of the below information.

Regards,

Donato Marrazzo

unread,
May 2, 2017, 6:01:13 AM5/2/17
to jBPM Usage

Hi Vinh,

First, I recommend you to use just the kie-server REST API. They are more reliable e "fresh".
The kieserver already exposes API to get/set variables:

## Get the variables


GET

<hostname>:<port>/kie-server/services/rest/server/containers/<container-id>/processes/instances/<process-instance-id>/variables


## Set the variables


POST

<hostname>:<port>/kie-server/services/rest/server/containers/<container-id>/processes/instances/<process-instance-id>/variables


if you want to access to the variable from the custom service, leverage the runtimeEngine


WorkflowProcessInstance processInstance = (WorkflowProcessInstance) runtimeEngine.getKieSession().getProcessInstance(instanceId);

processInstance.getVariable(name);

processInstance.setVariable(name, value);

visha...@googlemail.com

unread,
May 3, 2017, 1:55:08 PM5/3/17
to jBPM Usage
Hi Donato Marrazzo,

Thanks a lot for prompt reply. I am sorry I have not clearly mentioned about the exact requirement. 

We are storing a custom object as variable at the time of process instantiation. We need all the active processes custom objects(Stored as variable). There is no straightforward REST API which will give me these details with pagination. Although I can achieve this by calling two REST API e.g. First call to returns all the active processes and then by calling next REST API to get the  process variable, I thought of writing a extra endpoint which will combine these two calls.

I can consider the second option as well but then I have to use kie remote API's where ever I need this information. Does it provide pagination?

Using your example of rest-plug, I injected runtimedataservice and processservice and able to successfully get the custom object details for active processes. Thanks a lot for sharing such helpful example. It was great help.

Regards,

Vishakha
Reply all
Reply to author
Forward
0 new messages