1. What is Camunda
Unfortunately their API (ver. 7.8) doesn't provide a method to get a form definition with validations, so we have to extend this API with a new functionality.
To achieve the intended result we have to:
- get BPMN process definition,
- find form representation in XML DOM using XPath,
- parse Node to JSON as we want to be consistent with Camunda API.
To retrieve the BPMN 2.0 XML of a process definition we use Get XML method using Camunda REST API.
In this article we use sample process with the described by the following diagram:
Process definition in XML has the following structure:
To find form Node we use a simple Xpath expression.
The last step is to convert org.w3c.dom.Node object into JSON string.
For the given parameters:
you will get following JSON output: