Hi,
I am newbie using Bonita platform. Just created a process flow that connects to database and web service.
I am trying to get some examples/samples to call external rest API using rest connectors from a process flow. Also looking at samples that show how can we call the process in bpm using rest api.
Can somebody help with this request?
Thanks in advance.
Pooja
1 Like
hi Pooja,
I hope if you use the API Rest Extension Context (https://community.bonitasoft.com/project/restapicontext) it will help you.
regards
Kaant
1 Like
I can return single values like integers or strings but I can't return more complex objects, containing other objects and lists, to the BDM.
Let's say I consume this:
https://www.metaweather.com/api/location/44418/
How can I map the output to a BDM object with same structure?
1 Like
About the usage of REST API, do you want to process the result of the API call as part of the process (e.g. send an email with the response data, generate a document using the response data…) or do you want to display it to the user in a form (read-only)?
I’m asking because the solution would be different: for the first one you probably want to use a REST connector and store the result in a business variable, for the second you probably want to use a form variable initialized directly with the REST API call. In the first solution the REST API call will be performed by Bonita Engine who will run the process, in the second situation it will be performed by the user web browser who load the form.
1 Like
I want to test it both ways. I figured the 2 things last evening going over the documentation and the forum. I need some help processing the response data. I am storing the result as bodyAsObject but dont know how to get the result from it. I have understood it needs to be done in the script but dont know the syntax. Can you point to some sample code on how to extract data from bodyAsObject or set values for json object for PUT. Thanks again for responding.
1 Like
I just published a new example to illustrate the first option. It is available from the following GitHub repository: https://github.com/Bonitasoft-Community/rest-connector-to-business-data
1 Like
Hi Antoine, the .bos file is not importing into Bonita studio. Getting the below error:
!ENTRY org.bonitasoft.studio.ui 4 0 2019-07-10 20:39:50.592
!MESSAGE
!STACK 0
java.lang.IllegalArgumentException:
at org.bonitasoft.studio.importer.bos.model.BosArchive.toImportModel(BosArchive.java:66)
at org.bonitasoft.studio.importer.bos.operation.ImportConflictsChecker.checkConflicts(ImportConflictsChecker.java:43)
at org.bonitasoft.studio.importer.bos.operation.ParseBosArchiveOperation.run(ParseBosArchiveOperation.java:42)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
Thanks,
Pooja
1 Like
Hi Antoine, I installed v7.9.1 and imported the .bos file and its working. Sorry never noticed that you created that on a newer version. Your sample is really helpful for get me started.
Thanks,
Pooja
1 Like
Hi Pooja, I just published a second example that illustrate how you can directly within a Bonita web form call a REST API.
1 Like
Thanks a lot. Let me look at the documentation.
1 Like
Hey Kaant,
I tried the steps and while importing .bos file I got the error . Do you have any idea why this error is happening. I am able to import other .bos files without issues.
!ENTRY org.bonitasoft.studio.ui 4 0 2019-07-10 20:39:50.592
!MESSAGE
!STACK 0
java.lang.IllegalArgumentException:
at org.bonitasoft.studio.importer.bos.model.BosArchive.toImportModel(BosArchive.java:66)
at org.bonitasoft.studio.importer.bos.operation.ImportConflictsChecker.checkConflicts(ImportConflictsChecker.java:43)
at org.bonitasoft.studio.importer.bos.operation.ParseBosArchiveOperation.run(ParseBosArchiveOperation.java:42)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
Thanks,
can you please share the log for the error from logs.
And this type error will come when you try to import .bos file from any latest version of studio to its prior version… can you check the version of studio you are using?
Kaant
HI Kant, I am using studio version Version : 7.9.0 Build id : 7.9.0.
Also there are no error on the engine log . Only studio log is showing the error
!ENTRY org.bonitasoft.studio.ui 4 0 2019-07-10 20:39:50.592
!MESSAGE
!STACK 0
java.lang.IllegalArgumentException:
at org.bonitasoft.studio.importer.bos.model.BosArchive.toImportModel(BosArchive.java:66)
at org.bonitasoft.studio.importer.bos.operation.ImportConflictsChecker.checkConflicts(ImportConflictsChecker.java:43)
at org.bonitasoft.studio.importer.bos.operation.ParseBosArchiveOperation.run(ParseBosArchiveOperation.java:42)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
hey pooja
if you are taking the bos file from prior version to 7.9 studio then this should not happen. One more thing we should not import bos file from subscription edition to community edition or vice versa.
I guess you will find some engine log after that error populates…check once.
Hi Kant,
I had 2 .bos file. I installed v7.9.1 and imported one of the .bos file and it worked fine. So your suggestion was correct. For the other .bos file I am still facing issue but i think i am fine for now. Thanks again for helping. Really appreciate.
just import with fresh bos file that will also be fixed and what was your actual requirement ? db access using db connectors ?