Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JBPM rest calls with JSON

We want to start a process in JBPM6 using the rest API. We need to pass an object as a process variable.

We know how to do it JAXB and the execute call. But we want to do it with JSON and /runtime/{deploymentId}/process/{processDefId}/start

Is it possible? we try and have no success.

like image 578
Carlos López Avatar asked Mar 07 '14 23:03

Carlos López


1 Answers

I am not sure whether my answer exactly addresses the question. But for someones use in future I place couple of lines here.
If you want to set a process variable when starting a process using the RESTful API, you can do it like this.

If your variable name is myVar just add the value as a URL parameter by appending the phrase "map_" to the parameter name. It means the parameter name should now be map_myVar. For an example see below request.

http://<host>:<port>/jbpm-console/rest/runtime/{deploymentId}/process/{processDefId}/start?map_myVar=myValue

You can confirm whether the value is set by writing below code in a script task.

Object var = kcontext.getVariable("myVar");
System.out.println("myVar : " + var);

See the 17.1.1.3. Map query parameters section of JBPM6 documentation.

like image 97
prageeth Avatar answered Oct 23 '22 08:10

prageeth