How to enable the Bonita HTTP APIs in Bonita version 6.x ( the ones that were available with version 5.x as Bonita REST APIs ) ?

Hi

We have used the Bonita REST APIs available with version 5.10 to integrate with our application. Now we are trying to upgrade to the new versions of Bonita (6.x) and it looks like those APIs are now available as HTTP APIs. But I don’t know how to enable those APIs. With the previous version we had generated the bonita-rest web application from the Studio and deployed it to Bonita Tomcat.

Yes. We are aware that there is a new set of APIs called Web REST APIs and we could change our application to use that. But we may have to make some changes to our application to deal with the Authentication part before accessing the other APIs. Previously we had used the Basic authentication and it worked fine.

I would appreciate your insights.

Thanks
Joseph

Hello Joseph,

The HTTP API (new in v6) is meant to be accessed with the Bonita Java client library. You should not write your own HTTP requests to use it as there are no structural evolution guarantees and no documentation. We only guarantee that there will be no API breaks on the client side (the request’s format may change at any time between versions).

The way to use the HTTP API within some Java code is the following:

  • setup the API type to HTTP
  • specify the target platform URL and app name
  • log in and perform your java API calls (which will be transformed into HTTP requests behind the scene)

Here is a code example of the use of the HTTP API:

final Map apiParameters = new HashMap(); apiParameters.put("server.url", "http://localhost:8080"); apiParameters.put("application.name", "bonita"); APITypeManager.setAPITypeAndParams(ApiAccessType.HTTP, apiParameters);

final LoginAPI loginAPI = TenantAPIAccessor.getLoginAPI();
final APISession apiSession = loginAPI.login(USER_NAME, USER_PASS);

Now, if you want to write your own HTTP requests then, you should use the REST API.
This API is documented and has some structural evolution guarantees (no API breaks between versions).

Please note that this new REST API in v6 is not similar to the one used in Bonita v5:

  • the authentication mechanism has changed
  • the structure of the API is now RESTful (v5 was not entirely)

You can read more here:
http://documentation.bonitasoft.com/product-bos-sp/web-rest-api-0

Hope this helps,

Philippe

Hi Philippe

Thank you for taking time to answer my question. I also had the same impression. Unfortunately we are not using the Java API in our case. We will probably look into the options of using the REST APIs in V6 instead of the HTTP APIs. I was trying to see if we can do something so that we can integrate our application with the new version of Bonita without making a code change on our side :slight_smile:

Thanks
Joseph

hi, someone that knows how to use the rest api, would you help me please? I’m a beginner and I don’t know how to integrate mi own project :T