Variable values will, in general, only be available if explicitly set in you process or passed in when the process is started.
I am no expert, and others may correct me, but if your “form” isn’t stored in a process variable, then there is no way to retrieve it using the REST API. If your form is stored in a process variable, but the value you want is embedded within a document, you will either need to extract it inside the process and set process variable with its value (execution.setVariable(“formValue”, “This is the value I want”)), or you will have to consume the document at the client and parse it out yourself.
As I stated, I may be wrong about where “form” data might reside, but the only way your going to get a value from your process using the REST API call you mentioned is to explicitly set it. This can be done either in the BPMN itself, a script associated with the BPMN, or in a separate Java class. The method for setting and retrieving process variables varies depending upon which of the preceding you’re using, but they generally involve some form of the “execution.setVariable” or “execution.getVariable” function. In Java you do this through the Java delegate.
After some tests, I could access the variables using /get-variable API REST. The difference now is I can access after Complete the task, not only save. Anyway, it is enough for me now.
In the form-Camunda, in TaskList, I can see it. Then I edit the form and Save. When I try to retreive the variables, It shows the default values from the begining, not the updated values.
I did not solve this situation that you save and retrieve the updated variable value, as you describe. In fact, I did not implement “Save” funcionality in my application and not investigate it in deep.
I don´t know if it is a bug or a expected behavior.
Anyway, I access the variable data in a Python script as above:
def get_process_variables(process_id):
url = 'http://localhost:8080/engine-rest/engine/default/variable-instance?deserializeValues=false&processInstanceIdIn={}'.format(process_id)
r = requests.get(url)
variables= r.json()
return variables
To access variables in the Data Form, I use:
def get_form_variables(task_id):