Using returned JSON value as camunda variable

vakgroepopdracht.bpmn (17.3 KB)

Hi,

Not being very talented in programming (I’m a business analyst), I’m making a Proof of Concept for actually using Camunda in our organisation. So, together with some other dudes, we created a fictional process to show the capabilities of something like Camunda.

So far so good, but we’re facing an issue. We can’t get an element from a JSON response inserted as a Camunda variable (the variable is needed further in the process in the DMN).

We were trying to call an OpenAPI, and insert (form) variable ‘kenteken’ as a query string in the inputparameter ‘url’. We do this using a script. This should result in calling the API with this value.
→ How do I know this actually happens?

Anyhow, now we want the returned JSON element ‘brandstof-omschrijving’ inserted as a camunda variable. We are doing this with a script (see screenshots). What’s going wrong here?

I hope this is simply a syntax issue or something, but I’d love to see a suggestion in how to get this working.

You want to use Camunda SPIN, which is the helper lib for working with Json https://docs.camunda.org/manual/7.7/reference/spin/json/01-reading-json/

Take a look at

for a example of handling JSON response from a Connector HTTP request