AnsweredAssumed Answered

Create/Update a complex object process variable using RESTful

Question asked by yisa on Nov 9, 2014
Latest reply on Nov 19, 2014 by jbarrez
Hi,

I'm trying to use this REST api runtime/process-instances/{processInstanceId}/variables/{variableName} to create (and update later) a process variable that's an object. The object is something like the following:

{"id": 1,  "name": "testName", "externalData": {"id": 2, "name": "String"}}

I'm having a hard time to figure out what to pass in the value field as the input to the REST api. Stringify the above object into JSON didn't help. I got 415 error. If I set the variable type to serializable, how is it possible to pass raw byte array of my data object to a REST api?

According to the topic at http://forums.activiti.org/content/passing-complex-objects-instantiate-process

"This is currently not possible. In the new REST-api, this will be possible because there is a pluggable mechanism for variable-types. It will allow you to plug is some code to create a POJO based on a JSON-representation (exposed as a Map). This will be available in 5.13 of 5.14."

I'm using 5.15, so I'm assuming it's possible now. I would appreciate if someone could point me to some examples of storing a complex object as variable through REST api and have the variable be accessible within the workflow.

Outcomes