Using Custom REST API inside UI designer
So now i have been able to get the API running 100% working fine and i want to use the API inside the UI designer
API looks like this http://localhost:8080/bonita/API/extension/sqlExample?queryId=getPersona... it shows the complete REST API info like this
and i want to use inside UI Designer , so i added a new variable and i used the API like this
Trouble is, it does not show up inside the UI designer form
Is there something i am not doing correctly?
Can you shared how you bind the form variable that store the result of the REST API call with the form widgets?
Note that your API return an array (with a single object). If you expect a single result you might want for example to use the following syntax:
myFormVariableName.fullname when setting the value of a widget used to display the full name.
First I think it's important to clarify one thing:
- Do you want to store your travel request using Business Data Management (BDM) Bonita features?
- Or do you want to store those information using a database you will managed yourself?
Note that BDM database can be configure to use various database system (MySQL, PostgreSQL, Oracle, SQL Server) and can be located wherever you want (this is true for a server setup, in Studio embedded environment the only option is to use the h2 database provided by default).
I ask to clarify this because you are reporting using the SQL data source REST API extension. This extension is useful if you choose to use your own database. But at the same time in your process I can see that you have declared a business variable and so are using the BDM feature.
If you don't have any specific constraints I would recommend to use the BDM feature.
Can you explain why do you want to use an external PostgreSQL database and not use the BDM to hold the data?
I'm asking because with your current solution you will duplicate data in two different places: your PostgreSQL database and the database managed by Bonita (that can be configured to use PostgreSQL). I think you should avoid such duplication.
I also want to add that getting the business variable value (managed using the BDM) in a form is quite easy (using REST API call) compare to relying on an third party REST API extension.
In the example you shared can you tell me in which step you are trying to display the data? I don't find the call to the REST API extension.
In such situation put
myFormVariableName.fullname (where myFormVariableName is the name of the form variable initialize with your REST API call) as the value property of a form widget and it should display it correctly.
Before creating a complex process with several tasks, forms and complex data objects I would recommend to start with a simple one. Once you can display and edit data as you want then make the process more complex.
No, select for example an input widget added to your form and in the panel on the right you have a property named "value", in this property enter:
This is probably exactly the same kind of issue as reported in your other question.
Make sure (using web browser developer tools) that the data sent when submitting the form (formatted in JSON) match the contract defined on the process or task.
Also make sure that the contract value is appropriately used to set the business variable value using default value or operations on the task.
If you still have trouble with that, please post the content of the POST request sent when you submit the form, a screenshot of your contract and screenshot of operations and/or business variable default value script. Please do all that in another new question.
So to summarize, the issue is mainly related to data structure and how they are bound to widgets.
I highly recommend to read: