I suspect the reason there is not “cart blance” access to an activities variables is for security reasons.
I mean if REST were able to dump all activities and all process variables it would be invaluable to someone who wanted to “follow” the data.
I noticed, as did you, that all REST calls have to refer to an existing variable and, as a first line of defense, this is as good as any, if you don’t know the variable name then you won’t be able to get the data.
This is a good time to think of expansion capabilities to BonitaSoft. For example a Data Dictionary that stores all variables in a process, where they are used, co-defined etc. in a database for your own company records etc. This database could then be interrogated by a REST program to get the specific variables one by one for a specific case.
Some of this is already in subscription versions, the documenting of processes for example.
To shortcut the process though, you could do this:
Make a copy of your process from studioInstallDirectory\workspace\default\diagrams - DO NOT USE THE ORIGINAL in-case you make a mistake. e.g processCompanyVacations.proc
Open your processCompanyVacations.proc in notepad++ (if using windows, an excellent text editor) and do a CNTRL-F to find. Find String “<data” (without quotes) and click Find all in Current document. This will give you a list of all variables in the current process.
Copy from the Find results page and edit down to a list that you can now add to your REST processor, you are looking for the name field. If you also need the field type then look for the associated datatype (which is another XML node).
I think you know what happens next
List processVariables = ["var1", "var2", etc.]
for(String processVariable : processVariables){
REST call to get activityVariable or caseVariable
//do your processing
}
That should do what you want. This is a dreadful shortcut. The proper way would be to read the executing process definition, save the variable list and then execute the REST call, this way if a process changes you will always have the real data.
With this shortcut you will have to regenerate the Data Dictionary List each and every publication time.
Hope this sort of helps,
regards