In the previous blog, we already explained how you can start your process from a SOAP interface. It is also possible to do this with a REST call. For this you need to find out a couple of things about your process after which you can do a post on the Oracle API to start the process. You can use any REST client you want, in this example we use Postman.
First of all, you need to query the process definitions API. This can be found by putting /bpm/api/4.0/process-definitions after the baseUrl, in our example:
Luckily PCS does not allow just anyone to see this information. We need to use Basic Auth and enter our username and password.
After pressing the update request button, the headers are updated with the Authorization information.
Now when we press send, we will get back the information from the definitions that we are looking for. You get information about all the processes that are within this PCS domain.
From this result, we will focus on the PizzaPreparationProcess 2.0. The information we need to start the process, is the processDefId, the servicename, the operation and the input params. The input params have to be valid accordingly to the schema that has been send back.
When the input params are not correct, you will receive an error, especially when using complex input it can be a challenge to write this in json. There are good tools, like jsonlint out there to help you validate your json and remove whitespace (this is necessary). With above tips and some help from Lonneke, who reviewed the input, after which it worked perfectly!
It might be helpful if Oracle was able to send a more clear schema back, instead of what you see above.
To actually start the process, we will need to call the processes api, this is the baseUrl extended with /bpm/api/4.0/processes. In our case: https://pcs-jarvis18.process.us2.oraclecloud.com/bpm/api/4.0/processes
We do not want to do a GET anymore, but a POST.
This will result in a started instance, in our case instance #167.