BPMN and DMN XMLs from Camunda DB(via REST API)

Hi All,

I am saving a bpmn which has a reference to a dmn. Post deployment, i was looking for an API to retreive both bpmn and dmn xml from camunda database.
Is there a rest API which gives back a bpmn xml and related dmn xmls?

Please do let me know if it is possible and other workarounds. Plus how to establish a connection between a bpmn and related dmns.

@Ingo_Richtsmeier : any insights to it?

Jatin Mahajan

There isn’t a single API to do this, you’d need to use multiple calls to get each model.

thanks for the reply.
I have one more query, can String xml returned be re-modelled into BpmnModelInstance, if it is then how can we do it?



Hi @jatin,

yes, you can use the response from https://docs.camunda.org/manual/7.12/reference/rest/process-definition/get-xml/ and use it in the model api: https://docs.camunda.org/manual/7.12/user-guide/model-api/bpmn-model-api/read-a-model/.

Same for a DMN diagram, just different endpoints.

Unfortunately I haven’t any code snippet at hand to show the details.

Hope this helps, Ingo

@Ingo_Richtsmeier thanks for the input. I was following this only however, Caused by: java.lang.ClassNotFoundException: org.camunda.bpm.model.bpmn.Bpmn
this exception is coming if i directly use the XML string returned.

I have used both the methods with different set of Files and i am able to use them but directly converting modelInstance from the XML String returned is causing the problem.

PFA Complete Exception Stack Trace :

Exception in thread “main” java.lang.NoClassDefFoundError: org/camunda/bpm/model/bpmn/Bpmn
at com.abc.appintgwkflw.wkflautomate.was.test.main(test.java:777)
Caused by: java.lang.ClassNotFoundException: org.camunda.bpm.model.bpmn.Bpmn
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
… 1 more

Thanks & Regards,

Hi @jatin,

I think you’re either missing dependencies or mixing up package names.

Here is an example in the documentation: https://docs.camunda.org/manual/7.12/user-guide/model-api/bpmn-model-api/respository-service/.

It refers to a complete example on github.

Please check this example and the pom.xml there.

Hope this helps, Ingo


Thanks for the quick revert. I figured out that there was some dependency issue which was causing it.
Thanks a ton for the quick replies.

Thanks & Regards,