In this tutorial, we try to call a public REST service from a task in Bonita. The public service is available on https://www.boredapi.com/api/activity. This service returns a response in JSON format. We will create a business process (using Bonita) with a simple task. On this task, we create a connector that calls this service and parse the returned response.
Name | Type |
---|---|
Find something to do | Service |
Get full response | Human |
Get details | Human |
Name | Data type |
---|---|
response | Text |
activity | Text |
type | Text |
participants | Integer |
price | Double |
link | Text |
bodyAsObject.toString()
First List | Script name | Java code to add in the script editor |
---|---|---|
type | getType | bodyAsObject.type |
link | getLink | bodyAsObject.link |
price | getPrice | bodyAsObject.price |
participants | getParticipants | bodyAsObject.participants |
Text Area | Value | variable Name | variable Type | variable API URL |
---|---|---|---|---|
Type | type.value | type | External API | ../API/bpm/caseVariable/{{task.caseId}}/type |
Participants | participant.value | participants | External API | ../API/bpm/caseVariable/{{task.caseId}}/participants |
Price | price.value | price | External API | ../API/bpm/caseVariable/{{task.caseId}}/price |
Link | link.value | link | External API | ../API/bpm/caseVariable/{{task.caseId}}/link |