Exposing a WF as a rest service


#1

Hi TEam,

I have an usecase where i need to expose a workflow as a service so that it could be used by a expternal system (it will take some inputs and need to return certain output).
i was hoping to you CAMUNDA’s rest engine to do so, however once the workflow is started it always gives a standard response with instanceId and other details. i need to return some specific process variables.
what is the best approch to achive this?

Thanks
Sandeep


#2

Do you need to control the entire response or just ensure that the response has “at least” the variables you require?

Look at the rest api for Start Instance and there is a “withVariablesInReturn” param you can have the created instance return all of the created variables.

Other options as you will see in the forum are to create a new web service with something like jax-ws. Or create a small middleware app that fronts the camunda API and will manipulate your data into its own form. If you decide middleware, here is a example: Function as a Service API


#3

Thanks for the response Stephen. i tried withVariablesInReturn option and this returns all the process variables. i was hoping to see if there is a way to return only specified variable so we could limit the response payload to a minimum. to achieve this i guess the only option is to go through a middleware layer as you mentioned earlier.

Thanks for your help Stephen.

Thanks
Sandeep


#4

A “slightly messy” option is to create a Call Activity Sub process that does all of the “work” and only output/return variables to the parent process that you want to actually return.

But yes middleware or write a JaxWS is the way to go atm.


#5

Thanks Stephen. with this approach i can keep it to just 2 variables (input to the service and the output). will explore this option and see how it goes. else will stick to the middleware option. thanks again.

thanks
Sandeep