Custom App is an external application following business of company which is developed outside the ONEWEB platform. It can call the Process Runtime using the Process REST APIs to control the process. The REST APIs used to perform this is given in the table below.


Request

Description

Method

service/runtime/process/booking room/start

start flow

POST

service/runtime/tasks/{task_id}/assign?user=aaa&user=bbb

assign task (by users)

POST

service/runtime/instance/{instance_id}/tasks/assign?user=1

assign instance

POST

service/runtime/tasks/{task_id}/complete?user=test

complete task

POST

service/runtime/instance/{instance_id}/tasks

get task by instance id

GET

service/runtime/tasks?group=R0003

get task by user role

GET

service/runtime/tasks/{task_id}/claim?user=aaa

claim task

POST

service/runtime/tasks/{task_id}/variables

get task variable

POST


So from a Custom App, developer can use Ajax call to call the Rest Services. Example of how to use the APIs is given below.

Example method control process

This picture below is a process for "Booking Room". It starts the flow with choosing the room and then checking booking status. If the room is booked, then back to choose a new room. Else if the room is not booked, add details of customer into it and then save to database and update room status.



First Step: Start flow

Send parameter object to start flow, in this case is RoomObject and CustomerInfo.



Once the flow is started, system will return the instance id to control next step of process. In this case, instance id is "122056879-85735849-0b71-4299-9cd2-165f5b31c12e".

Second Step: Get task by instance id

Now the developer can get task name using the instance id from first step.



For the second step, system will return the task name, task id and so on. Please see picture above.

Third Step: Assign Task (by users)

Now Developer can assign the task using task id from second step with this URL below.

http://192.168.0.213:8080/BPMREST/service/runtime/tasks/122056910-494baede-088f-46bb-8a24-77b049ef996c/assign?user=origcmr4"


After task is assigned, data will be displayed in the To Do List of the user (Origcmr4). (See picture below)



Note: Developer can also assign task by using instance id from first step by this url below.

"http://192.168.0.213:8080/BPMREST/service/runtime/instance/122056879-85735849-0b71-4299-9cd2-165f5b31c12e/tasks/assign?user=origcmr4"


Last Step: Claim/Unclaim/Complete Task

Finally, Origcmr4 can claim / unclaim or complete task by this url below.


Claim : http://192.168.0.213:8080/BPMREST/service/runtime/tasks/122056910-494baede-088f-46bb-8a24-77b049ef996c/claim?user=origcmr4

Unclaim : http://192.168.0.213:8080/BPMREST/service/runtime/tasks/122056910-494baede-088f-46bb-8a24-77b049ef996c/claim?user=

Complete : http://192.168.0.213:8080/BPMREST/service/runtime/tasks/122056910-494baede-088f-46bb-8a24-77b049ef996c/complete?user=origcmr4


After Complete Task, process will go to the next node. Thus it will continue with the process following the configuration of the next process activity until end task.