JBPM rest calls with JSON
Asked Answered
L

2

6

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.

Limeade answered 7/3, 2014 at 23:7 Comment(1)
I got the answer... Read below.Lethargy
S
4

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.

Sorrel answered 23/3, 2015 at 8:31 Comment(0)
L
0

After talking to the dev that is responsible for the REST API. I was able to confirm how it works. The
/runtime/{deploymentId}/process/{processDefId}/start
Is a POST request where all the contents in the payload are ignored. The variables are written as key=value in the GET string.

With deployment id: com.web:work:1.0
With processDefId: work.worload
2 variables: var1 and var2
For example:
/runtime/com.web:work:1.0/process/work.worload/start?var1=a&var2=b

I'm still after trying to understand how to define objects with the remote API.

Meanwhile, I also confirmed that it is impossible to define objects using this way. The only way to define objects is only by using the JaxB. This uses the "/execute" path

Lethargy answered 25/3, 2014 at 9:40 Comment(1)
I'm having the same problem with objects. With JAXB we can start the process, but we found no way to start it sending a json objectPhenomenalism

© 2022 - 2024 — McMap. All rights reserved.