Sample use cases for Process API
Last updated
Last updated
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.
So from a Custom App, developer can use Ajax 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.
Step 1: 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".
Step 2: 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.
Step 3: 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: The developer can also assign tasks by using the instance id from the 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"
Step 4: 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 Completing Task, the process will go to the next node. Thus it will continue with the process following the configuration of the next process activity until the end task.