I use REST API Extension to retrieve some data from third-party software. I want to integrate that in the process using REST Connector. Apparently, the result always error 401 which means unauthenticated.
So is there a way for me to use the REST API Extension from the Process?
when you call a rest API extension from a REST connector, you need to authenticate since the HTTP call is done on server side and don't includes your api token
you could call:
first the login service (https://documentation.bonitasoft.com/bonita/2021.1/rest-api-authentication)
then extract the X-Bonita-API-Token
then use a second rest connector with this token as a header
then logout
This is not the best way to do since it requires to call 3 REST connectors and keep token in a transient variable.
instead:
extract the business logic of your connector (all except parameters parsing and json rendering) to a java jar
include this jar as a dependency to your rest api extension & your process
use a groovy script connector that will use you extracted jar
Bonitasoft empowers development teams with Bonita, the open-source and extensible platform to solve the most demanding process automation use cases. The Bonita platform accelerates delivery of complex applications with clear separation between capabilities for visual programming and for coding. Bonita integrates with existing solutions, orchestrates heterogeneous systems, and provides deep visibility into processes across the organization.