How to create and upload a new BPMN2 process definition in Guvnor using REST API ?
Environment
- Red Hat JBoss BRMS (BRMS)
- 5.3.x
Issue
- How to create and upload a new BPMN2 process definition in BRM (i.e. Guvnor) UI using REST API ?
Resolution
- There is a REST API http://localhost:8080/jboss-brms/rest/packages/{packageName}/assets exposed by Guvnor (i.e. BRM) to save a process into an existing Guvnor package. It not only accepts
content-type
ofapplication/octet-stream
but alsoapplication/atom+xml
as per the documentation [1] . But the point to be noted is that ..
when an Atom Entry is provided, the following information must be included in the input: asset name, asset description, asset initial category, and asset format.
- Attached is a small JBDS based Java project,
RestAPIConnectionTest.zip
, where the main programRestClientConnect.java
can be executed (please supply the appropriate REST API URL inurl
variable) as a standalone Java project. This program assumes that there is an existing and valid Guvnor package namedTestPackage
in the Guvnor. It would create a BPMN2 process definition namedSimpleProcess.bpmn2
inside theTestPackage
Guvnor package. The project can be imported directly into any Eclipse based IDE as a Java project and it has already got the required libraries to run as a standalone Java program. - This test case uses the
content-type
asapplication/octet-stream
and it reads the BPMN2 process definition (as Bytes stream) that is packaged inside the project.
Attachments
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments