REST API Connector Set-up and Use
Hi, I'm brand new to Bonita so please excuse my terminology.
I'm looking to use the REST API Connector to connect of a REST API of a Java service to extract data from a MySQL database. The format of the API is basically multiple Customers where each Customer has multiple Suppliers. There are other fields like Name, email address etc. I'll use in the workflow. I'm extracting these so I can send an email to the Customer and each supplier of that Customer, I can send emails via the email connector.
The challenge I'm having is extracting data from the REST API to use in the workflow. I can connect to the API successfully but how do I go about making data in the API available to the workflow ?
Thanks for your reply, I've also tried this method.
This is not a UI based task, its collect some data then make a decision on which email to send and repeat 3 times.
The challenge I'm having is that I can extract the data from MySQL, how do I process the data from there. I'm new to Bonita and don't understand the process of what I need to setup to use the data. Any advice would be welcome ?
And to complete, if you have to use an existing REST service, then you can use the REST connector.
If the service you call returns a JSON object, to use it, you just have to :
- Create a process variable
- Configure the REST Connector
- In the last configuration screen : select the variable you created to assign the result (bodyAsObject or bodyAsString)
- If needed, you can add a script Connector to parse the variable and get all the Suppliers for your Customer
If it returns a String object, you will have to parse it and get the informations you need in the string.
You make it sound so easy.
The service returns a JSON object.
I setup the process variable as a Java Object, however, when configuring the REST connector it says that its incompatible with bodyasObject.
I've created a services task where I've created the connector in the connectors in, should this be at pool level ?
I cant find any documentation on bodyasObject to understand how to configure and use it, do you know of anywhere I can find this information ?
Sounds good, I've tried to follow your example but I'm still struggling with the process of setting up the connector to extract the data and putting it into usable fields. Do I need to setup the fields before setting up the connector.
Setting up the Connector to connect to the REST API is easy but understanding how the data is extracted is not, the documentation doesn't help much.
If you have 10 mins free, it would be good to maybe skype to show you what I'm doing and you can tell me where I'm going wrong ?
If this task stream is not UI based then there is no need to use the UI, just use the already available MySQL Connector.
This will enable you to extract the data, return it to your workflow and then process it accordingly.
This is something we do all the time and is quite easy.
PS: As this reply offers an answer your question, and if you like it, please Mark UP and/or as Resolved.