create REST API in java and use in Bonita
Ok Good evening ,
I followed this tutorial today https://documentation.bonitasoft.com/bonita/7.5/rest-api-extensions
and i must say i enjoyed every bit of it, shows I can create my own REST api and use in bonita. Now there is something i want to be sure of, can i code the REST API in java as well and ask it to show its result in json? then register in bonita? i just need to be clear of certain things thats all.
Bonita REST API extensions are exactly that: a piece of code that can access Bonita Engine API and potentially external services and returns a result in JSON.
Language to create a REST API extension is Groovy. But if you know Java you should have no problem writing Groovy. You can write Groovy using the Java syntax. You find information about the difference between Groovy and Java in Groovy documentation.
Also note that you refer to the documentation for Bonita version 7.5. I always recommend to use the latest version available (today 7.8): https://documentation.bonitasoft.com/bonita/7.8/rest-api-extensions
Comments
i was trying to implement the api as you told me the last time , hence i decided to learn Groovy and since i knew java , picking up was not much of an issue ..
Now i want to show u something, i am trying to implement something like this
https://localhost:3000/api/user/2 and it should display the api on the json body
now my groovy rest api looks like this (Had to add jar files for mysql, bonita web extensions, slf4j-api) now my code looks somewhat like this :
The trouble i have now is how i can create the pages.properties file and use the encoding. I am on a windows Machine and notepad++ and notepad wont allow me to do that ISO 8859-1 encoding.
just need some advise here and as regards to my code, am I on track?
Ok for the Record, i have been able to save the encoded file in ISO 8859-1 encoding i just used notepad++ and it appears to be fine now
now here is what i want to do, i am going to test and see what comes up with the REST API i created.
many thanks again
Yes your are on good track. For information a REST API extension that use a data source (for performance consideration) to connect to an external (not Bonita Engine nor Bonita Business Data Model - BDM) already exists. I'll try to review and update the code of this extension soon.
Edit: I just review the code of the extension I mentioned in my comment and it runs without major change with Bonita 7.8.4.